King Computer Solutions
spacer
07.22.2009

Database connection error installing WordPress

A pre-note on installing WordPress: Read the official installation instructions first! By following the “5 minute install” instructions verbatim, I’ve never had a problem! Problems only happen when you don’t follow the instructions!
http://codex.wordpress.org/Installing_WordPress

Symptom: You’re installing WordPress and you’re getting database connection errors even though you have the settings correct.

Fix: It’s possible that you have the not correctly set the user permissions. For example, a permission for ‘wpuser’ is different from a permission for ‘wpuser’@’localhost’.

* Install phpMyAdmin and take a look at the Privileges tab for your wp database.
* Make a note of the usernames for non-root users.
* Switch to the MySQL console and remove these users with the command:

DROP USER 'username';

–or–

DROP USER 'username'@'hostname';

* Verify in phpMyAdmin that all users have been removed.
* Now go back to the MySQL console and run the following commands:

CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wp.* TO 'wpuser'@'localhost' IDENTIFIED BY 'password';

* Check your wp-config file. It should list ‘wpuser’ as the username and ‘localhost’ as the server hostname.

Now you should be able to run the install script as intended!