Mysql max_connections

On accessing the Plesk control panel you may receive the “PleskFatalException Unable to connect to database: Too many connections” error message and this is caused when the mysql connections on the server are exceeded than the specified value.

ERROR: PleskFatalException Unable to connect to database:
mysql_connect() : Too many connections 0:
/usr/local/psa/admin/plib/common_func.php3:190 psaerror (string
'Unable to connect to database: mysql_connect() Too many connections')

The temporary solution is to restart the Mysql service, and the permanent solution is to increase the max_connections value in the mysql configuration.

SSH to your server and restart the mysql service

# /etc/init.d/mysqld restart

If the problem is occurring quite frequently, you should increase the max_connections value in the my.cnf file. To check the existing max_connections value

# mysqladmin variables -uadmin -p`cat /etc/psa/.psa.shadow` \
 | grep max_connections

To increase the max_connections value, edit the /etc/my.cnf file

# vi /etc/my.cnf

and set the following parameter

max_connections = new_value

where, new_value should be the number higher than the existing mysql connections retrieved from the previous command.

Save the file and restart the Mysql service for the changes to take affect:

# /etc/init.d/mysqld restart

Leave a comment