How to fix Plesk mysql Fatal Exception

Today I received the following error when I was trying to use one of my forums and the server load was huge: 192.

It seems that there were too many connections towards the mysql server.

"ERROR: PleskFatalException Unable to connect to database: mysql_connect() [function.mysql-connect]: Too many connections"

 

The number of connections can be checked with this command:

[root@nyx ~]# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` extended-status | grep Max_used_connections
| Max_used_connections | 127 |
[root@nyx ~]#

I checked the Plesk Mysqld configuration and I had:

set-variable=max_connections=100
set-variable=max_user_connections=0 ##this is a bad idea because there won't be any limit to the sql resources a connection can access

I modified the /etc/my.cnf file with a new limit to both max_connections and max_user_connections:

mysql connections

And the server load started decreasing dramatically from 190 to about 18. Still too high but it was a step forward.
Checked the /var/log/mysqld.log and found some errors, so yeah, the database needed some repairing to be done.

PS: the mysql process list can be viewed like this:

 

mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` processlist | more

 

Posted in mysql, Plesk. Tagged with , , , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.