Search

Language:  
Search for:

Available article translations:

"Too many connections" error in Plesk interface

APPLIES TO:
  • Parallels Plesk Panel for Linux/Unix

Symptoms

Following errors pop-up occasionally in Plesk interface:

Unable to connect to database: Too many connections

SQLSTATE[08004] [1040] Too many connections

Cause

This error means that the limit of simultaneous connections to the MySQL server has been reached and that new connections to the server cannot be established at this time.

Resolution

There are two ways to solve this issue. The first one is to increase the connection limit, and the second is determine the cause of the "Too many connections" error and to use that information to lower MySQL server usage.

The MySQL server status can be checked using 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 |


The current connections limit settings can be found using:

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


In the above example, the maximum number of connections to the server ("max_connections") is set to 100. The maximum number of connections per user ("max_user_connections") is zero, which means unlimited. Default MySQL values can be redefined in /etc/my.cnf (/etc/mysql/my.cnf on Debian/Ubuntu). For example:

[mysqld]
set-variable=max_connections=150
set-variable=max_user_connections=20


Restart MySQL after my.cnf is modified:
/etc/init.d/mysqld restart


Note that if you set the connections limit to a very high value (more than 300), it may affect server performance. It is thus better to find and rectify the cause of the high MySQL server usage. You can check which users/requests slow MySQL on all current connections with the following command:

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



49af2da0f2dd4c81e962790bbbd0c2b4 5d735c0e028ee5b991e4fb80d34fb87f 56797cefb1efc9130f7c48a7d1db0f0c

FEEDBACK
Was this article helpful?
Tell us how we may improve it.
Yes No
 
 
 
 
 
 
Desktop Virtualization
- Parallels Desktop 8 for Mac
- Parallels Transporter
- Parallels Desktop Switch to Mac Edition
- Parallels Desktop for Mac Enterprise Edition
- Parallels Management-Mac for Microsoft SCCM
Server Virtualization
- Parallels Cloud Server
- Parallels Containers for Windows 6.0 Beta
- Parallels Virtuozzo Containers
Automation
- Parallels Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Web Presence Builder
- Parallels Plesk Automation
- Parallels Small Business Panel
- Value-added Services for Hosters
- Parallels Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification