You might have come across this error several times: “Could not connect to SQL database. Too many connections”.

Sometimes this error is also seen in the Plesk Control Panel Hosting. If the user tries to open a website in his/her browser an error is displayed : “Unable to connect to database: Too many connections”. The basic reason behind this error is the limited MySQL connection. This error usually occurs when the end user tries to connecty to the MySQL to the MySQL server and the connection offered is limited. This happens when the resources provided reach the peak and therefore anew connection cannot be establishes.

There are multiple ways to resolve such kind of issue. This post provides information about different ways to solve these issues. In order to resolve the ‘could not connect to sql server’ the first most important step is to increase the connection limit. As so son as we improved the connection limit secondly we can find and the reason of “too many connection error” and try to remove that error as well in MySQL server usage.

A User can check the MySQL server status through the ‘mysqladmin’ utility. For example to find out the number of current connections to the server use:

 # mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` extended-status | grep Max_used_connections
| Max_used_connections | 11 | 


You can easily find current connections limit settings which can be found with the help of below mentioned command.

 # mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow ` variables | grep 'max.*connections'
| max_connections | 100 |
| max_user_connections | 0 


The command mentioned below will give you a complete idea above the maximum number of connections which are connected to the server at that point of time. The maximum limit – (max_connections) is set to 100 and it will also show the number of connections per use (max_user_connections) it will be set to zero, that means unlimited. There are some default MySQL values. They can be redefined in /etc/my.cnf, for example:



Make sure that you restart the MySQL in your web hosting account after my.cnf modification. If a user set a connections limit to the higher value which is more than 300, that may affect your server performance. It is better to find out the reason of the high MySQL server usage. You may check what users/requests slowdown mysql and take all current connections, for example with the command:

 # mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` process list 


~~~~~~~~~~~~~ o ~~~~~~~~~~~~~

cloud based sql hosting

VMware & HyperV based Cloud Hosting Solutions ! Check Out TODAY!