WordPress can’t connect to the latest MySQL 8.x Server?

After migrating WordPress, WP can’t seem to login to the new MySQL container even when the password is correct.

Jeremy Cheng
2 min readJul 15, 2019
Official Info: https://mysqlserverteam.com/upgrading-to-mysql-8-0-default-authentication-plugin-considerations/

As of MySQL 8.0, by default, it uses an auth plugin called, “caching_sha2_password”. This is not something supported by a good number of applications yet including WordPress. So a possible solution is using the “mysql_native_password” plugin instead. This is not hard information to find online but I am posting this here yet again for my own reference as my team and I migrate a lot of WordPress sites.

If you are like me, I usually just pull the latest docker image of MySQL and the “latest” as of the date of this post is v8.0.16. This means by default, it’s not going to work with WP. So here’s what I do to mitigate the problem:

Note: this must be done prior to creating users as the plugin does not automatically update the passwords to the latest default plugin for accounts created prior to the switch.

  1. Start a new mysql:latest container with a static IP
  2. Get into the container:
docker exec -ti <container> bash

3. Update apt and install vim:

apt update -y
apt install -y vim

--

--