Results 1 to 18 of 18
  1. #1

    mysql too many connection

    Guys to say it clearly i am a newbie in this stuff concerning managing dedicated servers.. i have a linux machine with 512 ram and the linux version is fedora core 4 ..
    now my question is i have setted up only 1 site on this server.. but when ever i want to visit this site the machine says

    SQL error: Too many connections

    i have followed different advices from this forum such as max connection, and stuff but still i didnt mange getting a error free forum ...


    when i write top i get this results
    top - 11:36:45 up 10 days, 5:31, 1 user, load average: 76.27, 77.07, 78.36
    Tasks: 232 total, 1 running, 231 sleeping, 0 stopped, 0 zombie
    Cpu(s): 2.3% us, 3.3% sy, 0.0% ni, 0.0% id, 92.7% wa, 1.7% hi, 0.0% si
    Mem: 483196k total, 477676k used, 5520k free, 1344k buffers
    Swap: 2048276k total, 1036804k used, 1011472k free, 34468k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    20125 nobody 17 0 19624 5188 1688 D 1.7 1.1 0:03.87 httpd
    19764 nobody 15 0 18944 5284 1652 S 1.0 1.1 0:08.30 httpd
    18390 mysql 16 0 477m 220m 1724 S 0.7 46.8 4:22.04 mysqld
    21338 root 16 0 2148 1100 800 R 0.7 0.2 0:00.10 top
    373 root 15 0 0 0 0 S 0.3 0.0 4:40.59 kjournald
    18117 nobody 16 0 19240 4244 1620 S 0.3 0.9 0:23.45 httpd
    19771 nobody 16 0 18104 4908 1608 S 0.3 1.0 0:13.36 httpd
    20035 nobody 15 0 17344 4308 1700 S 0.3 0.9 0:08.91 httpd
    20859 nobody 15 0 14240 4456 1744 S 0.3 0.9 0:06.03 httpd
    1 root 16 0 1740 388 360 S 0.0 0.1 0:04.19 init
    2 root 34 19 0 0 0 S 0.0 0.0 0:00.32 ksoftirqd/0
    3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
    4 root 10 -5 0 0 0 S 0.0 0.0 0:00.21 events/0
    5 root 19 -5 0 0 0 S 0.0 0.0 0:00.03 khelper
    6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
    8 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
    78 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/0



    this is my my.cnf

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    # Default to using old password format for compatibility with mysql 3.x
    # clients (those using the mysqlclient10 compatibility package).
    old_passwords=1
    skip-innodb

    [mysql.server]
    user=mysql
    basedir=/var/lib

    [mysqld_safe]
    err-log=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    open_files_limit = 8192

    more over i want to know commands to
    1) see machine details
    2) See what all is installed on machine ? any commands for that ?

  2. #2
    Join Date
    Nov 2002
    Location
    WebHostingTalk
    Posts
    8,878
    * Moved to Technical and Security Issues

    Sirius
    I support the Human Rights Campaign!
    Moving to the Tampa, Florida area? Check out life in the suburbs in Trinity, Florida.

  3. #3
    Join Date
    Aug 2006
    Posts
    101
    If you have persistent connections enabled the turn them off.

    Increase your max connections is my.cnf and restart mysql

    max_connections = 600

    Make sure max_connections is under [mysqld]

  4. #4
    how to off persistaent connection

  5. #5
    Join Date
    Aug 2006
    Posts
    101
    This is turned off by configuration of the 3rd party software you are using. It would be something like config.php or config.inc.php and you would look for a line that contains persistent and set it to off or 0 (zero).

  6. #6
    [~]# service mysql restart
    Shutting down MySQL................................... [FAILED]
    Starting MySQL [ok ]

    this is what happending when i restart mysql
    and when i visit the site :
    SQL error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

  7. #7
    Join Date
    Aug 2006
    Posts
    101
    ps auxw|grep mysql

    Is it running?

    Also try ust running

    mysql

    If you get a prompt then just enter quit and press enter.

    If mysql isn't running the restart it again.

  8. #8
    thanks for so far reply

    root 18358 0.0 0.0 5448 448 ? S 09:04 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/mysite.net.pid
    mysql 18390 2.6 2.0 490224 10132 ? Sl 09:04 5:14 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/mysitename.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
    root 22047 0.0 0.1 4840 664 pts/0 R+ 12:21 0:00 grep mysql


    and mysql -p

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

  9. #9
    MySQL PID file could not be found! [FAILED]
    Starting MySQL [ OK ]

  10. #10
    Join Date
    Aug 2006
    Posts
    101
    well, if mysql isn't taking the kill signal then force it.

    kill -9 18358 18390

    then

    service mysql start

  11. #11
    now its started but how can i identify what the problem is ..

    this is the top

    top - 12:29:45 up 10 days, 6:24, 1 user, load average: 1.70, 17.98, 64.68
    Tasks: 177 total, 1 running, 176 sleeping, 0 stopped, 0 zombie
    Cpu(s): 63.5% us, 18.3% sy, 0.0% ni, 0.0% id, 15.6% wa, 2.7% hi, 0.0% si
    Mem: 483196k total, 472096k used, 11100k free, 3428k buffers
    Swap: 2048276k total, 314720k used, 1733556k free, 104716k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    20674 nobody 15 0 19364 9376 1632 S 37.7 1.9 0:08.69 httpd
    22157 mysql 16 0 22656 11m 2764 S 18.5 2.4 0:18.71 mysqld
    18124 nobody 15 0 18952 9060 1616 S 17.3 1.9 0:13.46 httpd
    18126 nobody 15 0 19068 9224 1668 S 1.9 1.9 0:30.11 httpd
    18135 nobody 15 0 19588 9544 1636 S 1.5 2.0 0:23.73 httpd
    18314 nobody 15 0 19148 9248 1612 S 1.5 1.9 0:09.85 httpd
    22215 nobody 15 0 18808 9704 2208 S 1.5 2.0 0:03.19 httpd
    22315 nobody 15 0 13464 3404 1564 S 1.5 0.7 0:00.22 httpd
    22366 root 16 0 2016 1060 800 R 0.6 0.2 0:00.06 top
    129 root 15 0 0 0 0 S 0.3 0.0 86:47.14 kswapd0
    18922 nobody 16 0 19284 6820 1472 S 0.3 1.4 0:11.34 httpd
    20370 nobody 15 0 14240 2516 1616 S 0.3 0.5 0:06.79 httpd
    22217 nobody 16 0 13464 3264 1492 S 0.3 0.7 0:00.14 httpd
    22277 nobody 16 0 18084 8936 2180 S 0.3 1.8 0:01.75 httpd
    1 root 16 0 1740 396 364 S 0.0 0.1 0:04.52 init
    2 root 34 19 0 0 0 S 0.0 0.0 0:00.32 ksoftirqd/0
    3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0


    can u guide me to a site which tells in details how to
    1) install mysql properly via putty
    2) install apche properly via putty

    i have a feeling i have installed a lot of crap on the machine and thats why its slow

  12. #12
    Join Date
    Aug 2006
    Posts
    101
    That's a little more invloved.
    Maybe you should consider using a control panel like cPanel if you aren't.

  13. #13
    i have cpanel,
    the only thing i am running is invision power board..

  14. #14
    now the site is saying :

    Service Temporarily Unavailable

    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.


    and i cannot find out where i have done any mistakes.. maybe something with the httpd ?

    this is the machine details :

    Processor #1 Vendor: AuthenticAMD
    Processor #1 Name: AMD Duron(tm) Processor
    Processor #1 speed: 1016.568 MHz
    Memory: 481708k/491456k available (2518k kernel code, 9136k reserved, 690k data, 180k init, 0k highmem)
    Processor #1 cache size: 64 KB

  15. #15
    Hi,

    In your first post, load was 76 with a swap file of 1036804 (1012 megabytes)

    I would recommend more ram, this issue might be caused, or partially caused because your server is just really overloaded. The CPU doesn't seem to be overloaded, i'd say it would be the memory, judging by the swap file size.

    So in order, I would:

    1) Get more memory installed, as much as you can afford
    2) Hire someone to optimise Apache, MySQL, etc, just the server generally in whatever way they can.
    3) If possible, enable some kind of caching plugin for your script(s) to reduce stress on the server.

    and that should do it :-)

  16. #16
    great i will put 512 mb more,
    where can u hire someone who can optimise the server cause 1 it should be a reliable source, next it should be cheap

  17. #17
    I'd put a gigabyte more actually to be honest, so you have 1.5, or go up to 2 gigabytes total.

    It might work with 512. Sometimes on an overloaded server, it will be fine up to a certain point, then the swap will grow and grow until it crashes.

    For the optimisation, you could ask your hosting company, they might provide a service, or I think on webhostingtalk there is a forum where you can ask. I'm not sure which, but it's on here somewhere.

  18. #18
    great thankyou all ,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •