User login

Attempting to debug MySQL Too Many Connections error

Web Search Notes

B.1.2.7. Too many connections
http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html

Error: Too many connections
http://forum.mamboserver.com/showthread.php?t=9732
http://forum.mamboserver.com/archive/index.php/t-9732.html

MySQL Forums :: InnoDB :: Timeout error occurred trying to restart MySQL Daemon.
http://forums.mysql.com/read.php?22,199072,199072

MySQL: ERROR 1040: Too many connections
http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/

Information from top:

top - 10:38:50 up 422 days, 13:30, 2 users, load average: 30.96, 23.70, 25.72
Tasks: 391 total, 1 running, 331 sleeping, 0 stopped, 59 zombie
Cpu(s): 0.0%us, 33.3%sy, 0.0%ni, 0.0%id, 66.7%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1035736k total, 1023664k used, 12072k free, 5440k buffers
Swap: 2650684k total, 1315284k used, 1335400k free, 39572k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12816 ben 16 0 2500 1268 800 R 64 0.1 0:01.95 top
1 root 15 0 1852 108 88 S 0 0.0 0:37.65 init
2 root RT 0 0 0 0 S 0 0.0 0:02.12 migration/0
3 root 34 19 0 0 0 S 0 0.0 0:00.19 ksoftirqd/0
4 root RT 0 0 0 0 S 0 0.0 3:31.18 migration/1
5 root 34 19 0 0 0 S 0 0.0 0:00.34 ksoftirqd/1
6 root 10 -5 0 0 0 S 0 0.0 0:00.02 events/0
7 root 10 -5 0 0 0 S 0 0.0 0:00.00 events/1
8 root 10 -5 0 0 0 S 0 0.0 0:00.00 khelper
9 root 10 -5 0 0 0 S 0 0.0 0:00.00 kthread
13 root 10 -5 0 0 0 S 0 0.0 0:01.83 kblockd/0
14 root 10 -5 0 0 0 S 0 0.0 0:01.70 kblockd/1
15 root 15 -5 0 0 0 S 0 0.0 0:00.00 kacpid
130 root 10 -5 0 0 0 S 0 0.0 0:00.00 kseriod
176 root 18 -5 0 0 0 D 0 0.0 2:52.76 kswapd0
177 root 13 -5 0 0 0 S 0 0.0 0:00.00 aio/0
178 root 13 -5 0 0 0 S 0 0.0 0:00.00 aio/1
334 root 15 0 0 0 0 S 0 0.0 0:00.06 kirqd
653 root 11 -5 0 0 0 S 0 0.0 0:00.00 khubd
687 root 19 -5 0 0 0 S 0 0.0 0:00.00 ata/0
688 root 20 -5 0 0 0 S 0 0.0 0:00.00 ata/1

Did any of this possibly shut the MySQL server down?

ben@server:/var/log/apache2$ sudo /etc/init.d/mysql restart

Password:
Stopping MySQL database server: mysqld failed!
Starting MySQL database server: mysqld already running.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

ben@server:/var/log/apache2$ /usr/sbin/mysqld

080821 11:49:38 [Warning] Can't create test file /var/lib/mysql/server.lower-test
080821 11:49:38 [Warning] Can't create test file /var/lib/mysql/server.lower-test
080821 11:49:38 [Warning] One can only use the --user switch if running as root

/usr/sbin/mysqld: File '/var/log/mysql/mysql-bin.index' not found (Errcode: 13)
080821 11:49:38 [ERROR] Aborting

080821 11:49:38 [Note] /usr/sbin/mysqld: Shutdown complete

ben@server:/var/log/apache2$ ps

PID TTY TIME CMD
13674 pts/1 00:00:00 bash
14418 pts/1 00:00:00 ps
ben@server:/var/log/apache2$ sudo /etc/init.d/mysql restart
Stopping MySQL database server: mysqld failed!
Starting MySQL database server: mysqld already running.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
ben@server:/var/log/apache2$ vi /etc/mysql/
conf.d/ debian.cnf debian-start my.cnf
ben@server:/var/log/apache2$ vi /etc/mysql/my.cnf
ben@server:/var/log/apache2$ vi /etc/mysql/debian.cnf
ben@server:/var/log/apache2$ vi /etc/mysql/my.cnf
ben@server:/var/log/apache2$ sudo vi /etc/mysql/my.cnf
ben@server:/var/log/apache2$ sudo /usr/sbin/mysql stop
sudo: /usr/sbin/mysql: command not found
ben@server:/var/log/apache2$ sudo /usr/sbin/mysql
mysqld mysqlmanager
ben@server:/var/log/apache2$ sudo /usr/sbin/mysqlmanager
080821 11:54:07 You are running mysqlmanager as root! This might introduce security problems. It is safer to use --user option istead.

080821 11:54:07 [WARNING] can't open password file /etc/mysqlmanager.passwd: errno=2, No such file or directory
080821 11:54:07 IM pid file: '/var/lib/mysql/mysqlmanager.pid'; PID: 14566.
080821 11:54:07 accepting connections on ip socket (port: 2273)
080821 11:54:07 accepting connections on unix socket '/tmp/mysqlmanager.sock'
080821 11:54:07 guardian: instance 'mysqld' is running, set state to STARTED.

080821 11:55:58 Listener_thread::run(): shutdown requested, exiting...

The "Fix":
sudo /etc/init.d/apache2 start

After working again:
sudo tail -f /var/log/apache2/access.log
Showed all the usual 200s and 302s.

The stuff here:

-sh-3.1$ sudo tail /etc/httpd/logs/error_log

Is two days old.

Resolution

Searched words: 
mysqli mysql too many connections server failure MySQL Too Many Connections Errors

Comments

connection issues

Benjamin - I came across this post while searching for a solution for a problem with one of my clients' sites. I have been getting a Drupal error reporting: The mysql error was: Too many connections.. I think your post here is related, but it might as well be Chinese to me. Can you "translate" and tell me what all of this means in English (dumbed down for folks like me)? This site is still having issues and I need to get it resolved quickly. Thanks in advance for your help!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.