Error establishing a database connection - max_user_connections

Hello, I have been observing an error on our website for quite some time. Sometimes when you open the page, you get the error message “Error establishing a database connection”. The error occurs very rarely, unfortunately it occurs more often with my boss and with our customers. Everything seems to be fine with our server, I have had several consultations with our provider in this regard. The error does not occur in my development environment. After I enabled “debugging” in my WP installation, I found the following warning in the debug.log file: PHP Warning: mysqli_real_connect(): (HY000/1203): User o300771 already has more than ‘max_user_connections’ active connections in /homepages/23/d76777578/htdocs/flashaar/wp-includes/wp-db.php on line 1653.

As I have experienced, this can lead to problems with the database connection. However, I can’t increase the value for ‘max_user_connections’ because we are still working with a shared server. What can I do? I’m pretty clueless about this, as the error doesn’t actually occur at all with myself but mainly with customers of ours. Any idea?

Hi @PeterNicole,

Thanks for reaching out!

This error is related to the method that PHP uses to connect to your MySql database. I suspect that your server has only used “mysql” extension installed which uses the “mysql_connect” function to reach your MySql database. This extension is deprecated and is due to removal in future PHP versions due to limitations and security issues. What is happening is that the amount of connections and queries is exceeding the value your server has allowed.

The best way to resolve this is to request from your hosting service that they install the PHP “mysqli” extension so that WordPress can use it as its default connection method. If after adding this extension the error “max_user_connections” still appears you should also ask your hosting service to increase the amount allowed for your account.

Please let us know how it goes.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.