MySQL

Since SHA-256 password hashing is used by default since version 8 of MySQL, we run into a problem if users created with this encryption are attempted with a WordPress install. Below are the commands for creating a user with the native password setup (1 create user, 2 create database, 3 give user access to database, 4 flush privileges to make changes available):

CREATE USER 'UserNameHere'@'localhost' IDENTIFIED WITH mysql_native_password;

SET PASSWORD FOR 'UserNameHere'@'localhost' = 'PasswordHere';

CREATE DATABASE IF NOT EXISTS DBNameHere COLLATE 'utf8mb4_general_ci';

GRANT ALL PRIVILEGES ON DBNameHere.* TO 'UserNameHere'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES;

If you wish to change the password authentication type on the root user, you can do so with the following commands:

USE mysql;

ALTER USER 'UserNameHere'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PasswordHere';

FLUSH PRIVILEGES;

Leave a Reply

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