Wordpress install: Created User doesn't work (but root mysql user does) - help with wp_config?

Hi, I’ve followed this tutorial

  • it all works except for the database connection: Error establishing a database connection

I’ve narrowed down to user problem because I can connect with root (just to test) but none of the other others users work.

part 1: db

CREATE DATABASE nicedb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE USER ‘mrnice’@‘localhost’ IDENTIFIED BY ‘nicepass’; GRANT ALL PRIVILEGES ON nicedb.* TO ‘mrnice’@‘localhost’; FLUSH PRIVILEGES;

part 2: wp_config

define(‘DB_NAME’, ‘nicedb’); /** MySQL database username / define(‘DB_USER’, ‘mrnice’); /* MySQL database password */ define(‘DB_PASSWORD’, ‘nicepass’);

the above result gets Error establishing a database connection

when I use mysqlshow -u mrnice -p, it works with my password. Only root@rootpass works and gets me to the next page to configure the rest. How do I correctly configure a user for my wordpress db?

This is on Unbuntu 19.04, mysql Ver 8.0.17-0ubuntu2 and latest stable wordpress release.

Thank you!


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi the resolution came through some small modification of the sql commands:

CREATE USER ‘mrnice’@'localhost’ WITH mysql_native_password BY 'nicepass’; GRANT ALL ON nicedb.* TO 'mrnice’@'localhost’;

I am not sure if it was one or both of the commands.

this has been resolved.