I’m currently getting this error in the front-end only (not inside /wp-admin):

Warning: mysqli_real_connect(): (HY000/1203): User xxx already has more than
'max_user_connections' active connections in
/hermes/.../public_html/myhome/wp-includes/wp-db.php on line 1489

Warning: mysql_connect(): User xxx already has more than
'max_user_connections' active connections in
/hermes/.../public_html/myhome/wp-includes/wp-db.php on line 1515
Error establishing a database connection

And I’m wondering how come this appear when I’m the only visitor? I’m using WP 4.5.

I did contact the host who was kind enough to reply as below:

Currently your website is showing
'Error establishing a database
connection' because the user of the
database has exceeded the
concurrent connection limit for a
user of a database, which is 10. This
is the reason website is loads
database error. The script throws the
concurrent connection error when
number of database connections
exceed the limit set on the server. In
our shared platform, we allow
maximum of 10 concurrent
connections to a database, which is
ideal in the shared platform and it is
not possible to increase this limit.
The query limit for your website will
be reset within couple of hours so
you should be able to access the
database after couple of hours. 

There are two cases the script loads
above error, one is when there is a
high traffic to the website and
database concurrent connection hits
the limit and second case is the 
database connection is not closed in
the script, even for the moderate
traffic the script loads concurrent
connection error. To overcome this
issue, you have to close the database
connection immediately after
fetching the required content from
the database. To close the database
connection you can use
mysql_close() PHP function with
connection parameter. This will help
you to use database connection limit
efficiently. 

In other words, everything is fine at our end, it’s a WP error.

3 Answers
3

Not WordPress related, so I am not sure if I have the right to reply in here, but still increase max_user_connections in my.cnf MySQL configuration file since you are just testing.

There are number of causes for running out of connections, the most common ones involving when the Web/App server is creating unexpectedly large numbers of connections due to a miss-configuration or some script leaking connections or creating too many connections in error.

The solution: Some people increase max_connections to some very high number so MySQL never runs out of connections.

This however can cause resource utilization problems eating memory and cause MySQL server to swap or be killed by OOM killer process or very poor performance due to high contention.

Leave a Reply

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