I set up a MySQL user and database of the same name called drupal7. The database was empty, and the user had no permissions to anything besides that database. I attempted to run the drush site-install command like so:
drush si --db-url=mysql://drupal7:password@localhost:3306/drupal7

However, the fact that the username was the same as the database name causes a problem here in this line of code in line 65 of site_install.drush.inc:

$exec = str_replace($db_spec['database'], $replacement_db, $exec) . ' -e ';

The mysql username and database name were being replaced with 'information_schema', causing the following erroneous mysql command to be created and run: mysql -hlocalhost -P3306 -uinformation_schema -ppassword information_schema
and producing the following error:
ERROR 1045 (28000): Access denied for user 'information_schema'@'localhost' (using password: YES)

Here is a quick patch to fix the regular expression pattern to check for a space before the database name to make sure it only matches the database name, and not a password or username that is the same as a database name.

CommentFileSizeAuthor
site_install-dbname-username.patch948 bytesjergason

Comments

jergason’s picture

Version: All-versions-3.0-rc4 » All-versions-3.0

had the wrong version there.

moshe weitzman’s picture

Status: Needs review » Fixed

committed. thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.