• I’m installing WordPress on CentOS. I’ve created a MySQL user and granted (I thought) the necessary permissions to install WordPress but I’m clearly doing something wrong because I get the infamous, “Error establishing a database connection” message. When I supply the MySQL “root” user and the password in the wp-config.php file, the /wp-admin/install.php page displays with no problem.

    I’ve created my user by:

    mysql -u root -p
    CREATE user wpuser@localhost IDENTIFIED by ‘Rt\HdABkJEZ-h,N’;
    GRANT ALL PRIVILEGES ON wpdatabase.* TO ‘wpuser’@’localhost’;
    FLUSH PRIVILEGES;
    EXIT

    Any thoughts on why “root” works, but “wpuser” does not?

    Ed

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You didn’t set a password for wpuser. It should have been in one line; no CREATE USER needed:

    GRANT ALL on wpdatabase.* to 'wpuser'@'localhost' identified by 'PASSWORD';

    in wp-config.php, DB_USER is ‘wpuser’ and the password is that user’s password.

    Thread Starter edflecko

    (@edflecko)

    I have a syntax error and can’t quite put my finger on it.

    GRANT ALL on wpdatabase.* to ‘wpuser’@’localhost’ identified by ‘Rt\HEZ-h,N’;
    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 ‘Rt\HEZ-h,N’

    The version of MySQL I’m running is: 8.0.19

    Ed

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    That backslash is an escape; I don’t know if that’s ignored when inside a quote. I’d change the password to “ABCDEF12345” for right now and see if that’s the issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘MySQL user can’t access database to install WordPress’ is closed to new replies.