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

October 31, 2019 153 views
WordPress

Hi, I’ve followed this tutorial [https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04](http://)

  • 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 utf8unicodeci;
CREATE USER ‘mrnice’@'localhost’ IDENTIFIED BY 'nicepass’;
GRANT ALL PRIVILEGES ON nicedb.* TO 'mrnice’@'localhost’;
FLUSH PRIVILEGES;

part 2: wp_config

define('DBNAME’, '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!

2 Answers

this has been resolved.

  • Hi @vonparty,

    Can you please post the resolution here, where the permissions wrong for the user mrnice or was it something else entirely?

    Regards,
    KDSys

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

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

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

Have another answer? Share your knowledge.