WordPress “Error establishing a database connection” on MySQL 8

We have couple of WordPress websites running on a Linux 7.8 server. A week back we upgraded the MySQL to latest version. And all the websites continued to work normally.

Just 2 days ago we needed to install a new WordPress on the same server, but all our attempts failed with “Error establishing a database connection” even at install step. We struggled a few hours, but finally we figured out how to resolve this. The new versions of MySQL are using caching_sha2_password

The solution was kind of easy. We altered the DB user for the new website using NATIVE password:

ALTER USER '<username>'@'<host>' IDENTIFIED WITH mysql_native_password BY '<password>';

 

 

Related Posts