I can't figure out why and where Drush is set/configured not to use password when connecting DB.

For instance I was trying setup a quick site e.g. command drush qd which gives:

PDOException: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

Or is it even any configuration? Is it about qd command? Earlier I tried to add db user name and password along as parameters ie. --db-su and --db-su-pw but no go.

Of course I could remove password for root user but it doesn't help me in the future and certainly won't help in building secure sites.

So how can I get Drush to use password for db connections? Does it inherit configuration details from some other config php, mysql, apache, debian?

I'm using Drush 6.20 with Ubuntu 14.04, PHP 5.5.9 and Apache 2.4.7.

  • When you run "drush status" does it display correct database? How is your settings.php setup to connect to database?
    – pgrujic
    May 1 '15 at 15:17
  • Hi! I just removed whole lamp-server since it didn't work at all. Now I have bitnami stack and Drush installed trough apt-get it trying to use mysqld.sock from wrong location. Drush status gives now PHP configuration : /etc/php5/cli/php.ini Drush version : 5.10.0 Drush configuration : May 1 '15 at 16:14
  • I've now created a softlink from that wrong location and ended up in the original situation: Drush tries to connect DB without password. May 1 '15 at 16:30
  • 1
    I've sometimes had this issue with drush if, in drupal's settings.php, the db server is referenced as localhost. Hence, I tend to use, instead, on MAMP or similar.
    – Ollie
    May 2 '15 at 13:15
  • In my case I'm not using a site and contrary I'm building one with Drush command qd that is supposed to create everything from core to additional modules etc. therefore there isn't settings.php available and database configuration has to rely on some other config. May 2 '15 at 13:41

Your Answer

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

Browse other questions tagged or ask your own question.