I am using Drupal 7.54, Drush version 8.1.10, and MySQL version 5.7.17 on Ubuntu 16.04. I mainly use drush for drush up to make sure my packages don't get too old.

Last week, everything was working. Today, everything is still working on the website, and I can use mysql -h localhost --user bar baz -p (with the same info from the settings file) to log in successfully. However, today, when I tried to run drush up, it gave me an error:

Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more [error] functional Drupal environment to run this command. The drush command 'up' could not be executed. [error] Drush was not able to start (bootstrap) the Drupal database. [error] Hint: This may occur when Drush is trying to: * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See drush topic docs-aliases for details. * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

When I run drush up --debug, the only additional piece of information is this error:

Executing: mysql --defaults-extra-file=/tmp/drush_abc123 --database=obfuscated --host=localhost --silent  < /tmp/drush_def456
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

That makes it look like drush is trying to log in as root rather than as the user specified in the settings file, which is weird.

Between last week and this week, I did mess around with the database for an unrelated reason, so I'm sure I just messed something up there.

I tried rebooting the machine and restarting the MySQL service, and that didn't change anything. I tried changing from localhost to per the drupal.org suggestion, but that didn't change anything. drush status is pointing to the correct database even though the debug log makes it seem like it isn't.


It turns out, the issue was related to a bug in Drush. https://github.com/drush-ops/drush/issues/2183 discusses an error where a ~/.my.cnf file will interfere with Drush's database connection.

I didn't have a ~/.my.cnf, but I did have a ~/.mylogin.cnf. When I moved that file, everything started working again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.