Jul
28
This issue is mostly well documented elsewhere on the internet, but I recently found an unusual cause of this problem which I felt was worth documenting.
The following list should hopefully help you to isolate this problem, but if I’ve missed anything please let me know via comments:
- Firstly check you have updated the DB_USER, DB_PASSWORD and possibly DB_HOST in your wp-config.php file.
- Next, check the database is actually up and running. If you get a response from ‘mysql -u root -h DB_HOST -p’ then the database is running. (Replace DB_HOST with its value).
- Once you have logged into mysql as root (or with sufficient privileges) ensure the database is configured with the correct access rights with the following query (replacing DB_NAME, DB_USER, DB_HOST and DB_PASSWORD):
GRANT ALL ON DB_NAME.* TO 'DB_USER'@'DB_HOST' IDENTIFIED BY 'DB_PASSWORD'; FLUSH PRIVILEGES; - If you are having an issue where every time you go through these steps to configure one blog, another one throws this error in a vicious circle ensure that you don’t have two or more blogs all relying on the same DB_USER but different DB_PASSWORDs (even if you are using different DB_NAMEs) as every time you update the privileges for one password, you are effectively changing the password for that DB_USER, so any wp-config.php using that username but a different password will be unable to access the database.
Hopefully this will help at least one person.