Skip to content

Instantly share code, notes, and snippets.

@cesarmiquel
Last active August 29, 2015 14:12
Show Gist options
  • Save cesarmiquel/456bedcf8443ddae7cef to your computer and use it in GitHub Desktop.
Save cesarmiquel/456bedcf8443ddae7cef to your computer and use it in GitHub Desktop.
Create a Drupal site using drush and an installation profile

How to generate a new Drupal site via drush

  1. Edit your settings.php file and add a database connection setting db, user and pass. For example append the following to your empy settings.php:

      $databases['default']['default'] = array(
        'driver' => 'mysql',
        'database' => '<db>',
        'username' => '<user>',
        'password' => '<pass>',
        'host' => 'localhost',
        'prefix' => '',
      );
    

You don't need the db or user to exist. The following command will create them for you. To generate the user and db for the site with drush you need to execute the following using the DB root user / pass:

    $ drush sql-create --db-su=root --db-su-pw=<pass>

Once the DB is created you can test that it connects with:

    $ drush sqlc

If everything looks good the run the installation profile:

    $ drush si <profile-name> --account-mail <admin-mail> 

If you don't know the name of your profile you can use standard which is the default Drupal profile. You can see other names in the docroot/profiles directory (the name of the profile is the name of each subdirectory)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment