Portal Home > Knowledgebase > Articles Database > mysql connections
mysql connections
Posted by bbrog, 05-08-2012, 12:22 AM |
Hi, looks like someone is hitting the mysql database pretty hard. All sites using a database cant connect to it because there are i believe so many connections to it.
I went to my.cnf and looked for something called max_connections but couldent fint it.
Any one know what I can do to prevent this from happening?
Please do let me know thanks!
|
Posted by bbrog, 05-08-2012, 12:31 AM |
I also got this from mysqltuner.pl
>> MySQLTuner 1.1.2 - Major Hayden
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
ERROR 1040 (00000): Too many connections
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.91-community-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
ERROR 1040 (00000): Too many connections
ERROR 1040 (00000): Too many connections
[!!] InnoDB is enabled but isn't being used
Argument "" isn't numeric in numeric gt (>) at /usr/local/cpanel/3rdparty/mysqltuner/mysqltuner.pl line 636.
[OK] Total fragmented tables:
Use of uninitialized value in numeric lt (<) at /usr/local/cpanel/3rdparty/mysqltuner/mysqltuner.pl line 648.
[!!] Your server has not answered any queries - cannot continue...
|
Posted by bbrog, 05-08-2012, 12:45 AM |
When I tried to restart mysql from cpanel I got the following message even though I see mysql processes on top command
Waiting for mysql to restart...............finished.
mysqld_safe (/bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/server.host.com.pid) running as root with PID 410391 (process table check method)
mysqld (/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/server.host.com.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock) running as mysql with PID 434867 (pidfile check method)
mysql has failed, please contact the sysadmin (result was "mysql is not running").
|
Posted by TravisT-[SSS], 05-08-2012, 01:52 AM |
This may be of some help:
http://dev.mysql.com/doc/refman/5.0/...er_connections
|
Posted by SAHostKing, 05-08-2012, 11:59 AM |
you can set this in my.cnf file.
Set max_connections=200
or maybe even set the connect_timeout = 10
Really depends on setup
|
Posted by bhanuprasad1981, 05-08-2012, 02:15 PM |
better restart mysql from root try this way using ssh:-
you must disable http and mysql monitoring from cpanel service manager
1. service httpd stop
2. service mysql stop
3. pico /etc/my.cnf
4 add /edit required mysql variables like
max_connections=200
max_user_connections=50
5. CTRL+x (saves modified file)
6. service mysql start
7. service httpd start
enable http and mysql monitoring from cpanel service manager
run mysqltuner atleast 48 hours later and make changes as suggested
|
Posted by mugo, 05-08-2012, 03:24 PM |
Question. Is your web app and mysql db on the same box? If so, just cut off access for anything but your local IP and / or localhost, however you specify the connection (normally localhost).
This would only help if they are hitting your port 3306 directly. If they are slamming your web app, then you'll have to block via IP.
|
Posted by bbrog, 05-10-2012, 07:30 PM |
Hi, I have fixed this problem.
Solution is anyone else has this problem: My var on the hard disk was full and is was making mysql go crazy. So before pulling your hair make sure you have space.
Hopefully this helps if anyone else has this problem in the future.
|
Add to Favourites Print this Article
Also Read