MySQL: max_user_connections error (VPS & Cloud)

In order to prevent resource starvation, and performance degradation issues of your Linux VPS & Cloud servers we have deployed a default limit of the MySQL: max\_user\_connections variable for all of our VPS & Cloud servers. If you hit this limit, your website will most likely throw an error message that looks like this:

"Warning: mysql\_connect(): User xxxxxxxx already has more than 'max\_user\_connections' active connections in /home/xxxxx/public\_html/xxxxxxxx.php on line X"

To adjust this limit you need to modify the MySQL configuration file, which by default on most Linux distributions is located at:
/etc/my.cnf

Use your favorite text editor, or cPanel File manager and adjust the default setting to a higher number.

Please, be careful to not set this variable to a very high number in order to avoid potential stability issues, and high load caused by MySQL. We recommend on most servers this number to be below 100.

Once you adjust the variable to a higher number, you need to restart your MySQL service which you can do either through your control panel (cPanel or Plesk) or directly through command line interface of your VPS/Cloud with a command such as:

service mysql restart

In general if you are hitting the default max\_user\_connections limit that we have set, we recommend that you look into optimizing your applications code further to reduce slow queries which are one of the main reasons you maybe reaching this limit, or investigate any potential issues with high traffic, or abuse related issues such as attacks towards websites or applications hosted within your account.

The same error you may get if you are using WordPress or any other popular application like Joomla, Drupal, etc. In these cases a bad plugin, module, extension can be causing this issue, or generally a need for further tuning of the application maybe required. We recommend that you review the following Performance Optimization Tips, in order to speed up your website in general, which will most likely resolve the error you are seeing:

Website Performance Optimization Tips

We also recommend that you check with your application vendor, or application developer to make sure that your applications are NOT using persistent MySQL connections, which can lead to this issue as well. This should be an easy fix if its the case, but you will need to consult with your developer/application vendor first.

If you need further assistance, please contact our support.

For more information this variable and other MySQL related settings please, check