MySQL 8.x and WordPress

Recently I installed a new WordPress server (version 5.0.3) and decided to install the latest version of MySQL (8.0.15) and ran into some issues that people following my post on how to install WordPress on IIS need to be aware of.

Until PHP is updated to support caching_sha2_password in MySQL you won’t be able to use WordPress with this new authentication method. When you get to the following screen, you need to choose “Use Legacy Authentication Method” and not the new default “Use Strong Password Encryption for Authentication“.

If you choose Use Strong Password Encryption for Authentication you will receive the following error when you try to install WordPress and connect to the database.

The reason for this is that the MySQL 8 team changed the default value of the default authentication plugin configuration variable from  mysql_native_password to caching_sha2_password. This causes any client connecting to MySQL without specifying which password encryption method it uses to make MySQL assume it is using caching_sha2_password but most clients currently in use are assuming to use mysql_native_password.

If you have already installed MySQL 8 with the new default password encryption you can change it by running the MySQL installer again and choosing “Reconfigure” to change the password type back to the older encryption type.

You could also change it by modifying the my.ini file in **C:\ProgramData\MySQL\MySQL Server 8.0** and restarting the MySQL service. Find the following section and change the default authentication plugin setting to the following.

[mysqld]

default_authentication_plugin=mysql_native_password

Also, if you have already installed MySQL and created your “Root” user or any other user such as a WordPress user, they will be using this new password type so if you try to sign into MySQL using something like phpMyAdmin you will run into the following error.  As of 2/9/19 phpMyAdmin does not currently support this authentication type.

Once you have reconfigured MySQL to use the old authentication type you can change your currently created users to use this authentication type by doing the following.  Repeat this for any user you have already created.

Let assume your MySQL username is root and password is Somepassword
Open a command prompt and enter the following commands:
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysql_upgrade -uroot -pSomepassword
mysql -uroot -pSomepassword
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘Somepassword’;

Good Luck!

About The Author

I have worked in the computer repair field since the early 90's. I was a technician and then Coordinator of Computer Repair for Regional Education Service Agency II (RESA 2) for 18 years. I am currently working for Wayne County Schools as a Network Engineer/Technology Specialist. I am responsible for the schools Internet access, Wi-Fi, networks, servers, laptops, desktops, and their operating systems and software.

Related posts

Leave a Reply

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

+ fifty nine = sixty seven