Tuesday 22 November 2022

Install Drush Globally

 To install Drush globally follow below steps.

1. Run below command, To install Drush 8.x required for Drupal 8+.

    composer global require drush/drush:dev-master

2. Now run below command to add Drush to your system path.

         export PATH="$HOME/.composer/vendor/bin:$PATH"

3. Run below command to update to a newer version.

         composer global update

To install specific version of Drush, run below command.

        composer global require drush/drush:6.1.0

Some of the below common used Drush commands.

drush cc or cache:clear => To clear cache. When we run this command, will give some options to execute as below

          [0] Cancel

    [1] drush

    [2] theme-registry

    [3] router

    [4] css-js

    [5] render

    [6] plugin

    [7] bin

    [8] views

drush cr or cache:rebuild => Rebuild a Drupal 8 site.
drush updb or updatedb => Apply any database updates required (as with running update.php)
drush updbst or updatedb:status => List any pending database updates.
drush uli or user:login => Display a one time login link for user ID 1, or another user.
drush pml => To list modules
drush en module_name => To enable module
drush pmu => To uninstall module
drush site:install => To install Drupal site with Drush command.
drush sqlc or sql:cli => Open a SQL command-line interface using Drupal's credentials.
drush sql:dump => Exports the Drupal DB as SQL using mysqldump or equivalent.
drush sqlq or sql:query => Execute a query against a database.


No comments:

Post a Comment