1

If I use this line to install a drupal site it only runs fine if the 'mydb' database already exist.

If the database doesn't exist I get an error. Is there other drush command to make an installation when the database doesn't exist?

drush si --db-url=mysql://root:root@localhost:8889/mydb

I don't think is a user permission since the root user has all privileges enabled. Look the picture. I use MAMP (the free version)

enter image description here

I this other capture you can see the connection parameters:

enter image description here

3 Answers 3

3

I don't think Drush has an option for this built into the site-install method but you might find something under the sql-sync method, which I think has an option to create a database.

I don't know if it's appropriate for your situation but you might want to look at the Drupal Quickstart: Pre-made Development environment; it has a bunch of custom Drush commands included, one of which will set up an entire site (vhost file, database, file permissions, etc.) in one line:

drush quickstart-create all --domain=example1.dev

I've copied this command out and hacked it to pieces, and now I can install a fully configured Drupal site on my local Mac machine with a single terminal line:

drush isosc --domain=example.dev

I would thoroughly recommend doing this; I couldn't live without it now

2
  • Then I should always create the database before running the site-install method. Am I right?
    – chefnelone
    Commented May 25, 2012 at 10:33
  • Yes, definitely. Even if you could use a drush command to create the db you'd need to run it before the call to site-install, so it might be easier to just create the db using your standard method
    – Clive
    Commented May 25, 2012 at 10:35
1

drush site-install \ standard --account-name=admin \
--account-pass=admin \ --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase

This command create a completed installation (included db).

0

Looks like you have problem with your system variables. Enter "mysql" in cmd and check if it works correctly.

If it works then you would have some other issue. If doesn't then make it work by pasting your mysql.exe path usually "C:\xampp\mysql\bin" into PATH system environment variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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