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.
| Comment | File | Size | Author |
|---|---|---|---|
| site_install-dbname-username.patch | 948 bytes | jergason |
Comments
Comment #1
jergason commentedhad the wrong version there.
Comment #2
moshe weitzman commentedcommitted. thanks.