Upload Image
Drush logo

It’s a good feature of drush for drupal that you can install a new site with three simple step.

Step 1: Setup MySQL user and database

Create a database using drush command prompt.

Syntax:   drush sql-create --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase

Example:  drush sql-create --db-url=mysql://root@localhost/drupal_test

Note:  If 'mysql' is not recognized as an internal or external command, " operable program or batch file. " error occur, then set xampp mysql bin folder to the environment variable path like (c:\xampp\mysql\bin)

Step 2: Download latest Drupal

After the database created you need to download Drupal for setup of site.

Syntax: drush dl drupal (this will download latest Drupal)

Copy this folder to xampp\htdoc and rename the folder to your site project name for which you want to setup installation.

C:\xampp\htdoc> ren drupal-7.x drupal_test

C:\xampp\htdoc>cd drupal_test

C:\xampp\htdoc\drupal_test>

Step 3: Installation of site

Go to the installation directory run the command for installation of drupal site.

syntax: drush site-install standard --account-name=admin --account-pass=admin --account-mail=example@domain.com --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase --site-name="YourSiteName"

Example: C:\xampp\htdoc\drupal_test> drush site-install standard --account-name=adminname --account-pass=password --account-mail=admin@admin.com --db-url=mysql://root@localhost/drush_test --site-name="Drupal Installation"

Step 4: Run Your site

Now you can check your site in browser.

Drupal drush install