Drupal PDOException: SQLSTATE[HY000] [1045] Access denied for user

Published on Author JFLeave a comment

You might get this error and you’ve lost your mind trying to understand why you updated the password, logged into MySQL successfully from the command line, but still can’t get Drupal to talk to the db?

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'drupal_user'@'' (using password: YES) in lock_may_be_available() (line 167 of /var/www/html/website.com/includes/lock.inc).

The clue is probably right here beneath your nose:


In your settings.php file you have this:

$databases = array (
 'default' =>
 array (
 'default' =>
 array (
 'database' => 'website_db',
 'username' => 'drupal_user',
 'password' => 'mypassword',
 'host' => '',
 'port' => '3306',
 'driver' => 'mysql',
 'prefix' => '',

Note the host = You did this avoid a lookup for ‘localhost’.

Now check MySQL. Can drupal_user attach via localhost or

Either change your drupal host in settings.php to localhost or allow drupal_user access on



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.