After upgrading to Version 4.9. I got an error of Error establishing a database connection. The possible cause of ‘Error establishing a database connection’ is the problems in MySQL, check the username and password in wp-config.php. But the causes may vary.

Firstly, open ‘wp-config.php’ and set ‘define(‘WP_DEBUG’, ‘true’)’;

Then, go to the website to see the possible problems. In my case, the website indicated two errors, problems with my MySQL account and a warning: mysql_connect(): Headers and client library minor version mismatch.

I used this command ‘php -i|grep Client’ to check the possible cause of the warning. Turned out it was the version of MySQL being too old.

So, I changed the MySQL account settings in the wp-config file. Then, reinstalled MySQL to its newest version and restarted services with following lines:

yum remove php-MySQL

yum install php-mysqlnd

systemctl restart httpd

systemctl restart mysqld


Thanks to:


Leave a Reply

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