Do you get the following error when trying to create user and grant privileges ? The database error when creating :
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'dbusername' WITH GRANT OPTION' at line 1.
You may face this error when trying to install WordPress and when you try to :
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
The reason is from MySQL 8.0 it’s not any more possible to create a user directly from the GRANT command. You have to do this in two steps :
CREATE USER 'wordpressuser'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON databasename.* TO 'wordpressuser'@'%' WITH GRANT OPTION;
So, the steps to create WordPress DB and user would become :
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE USER 'wordpressuer'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuer'@'%' WITH GRANT OPTION;
That’s it !