Andrew Fletcher published: 20 April 2021 (updated) 26 July 2023 1 minute read
If your Composer project doesn't have Drush listed as a dependency, you can install Drush from command line as follows:
composer require drush/drush
To check your version of Drush, use
drush --version
Status check
drush status
Will output something similar to
Drupal version : 10.1.1
Site URI : http://default
DB driver : mysql
DB hostname : mysql
DB port : 3306
DB username : your_username
DB name : drupal
Database : Connected
Drupal bootstrap : Successful
Default theme : {theme}
Admin theme : {theme}
PHP binary : /usr/local/bin/php
PHP config : /usr/local/etc/php/php.ini
PHP OS : Linux
PHP version : 8.2.8
Drush script : /app/vendor/drush/drush/drush
Drush version : 12.1.2.0
Drush temp : /tmp
Drush configs : /home/icon/.drush/drush.yml
/app/vendor/drush/drush/drush.yml
/app/drush/drush.yml
Install profile : standard
Drupal root : /app/web
Site path : sites/default
Files, Public : sites/default/files
Files, Temp : /tmp
Have you configured Drush alias
drush site:alias
'@self.dev':
root: /var/www/your-domain.com
uri: your-domain.com
host: your-host-domain.com
user: idev
paths:
drush-script: /var/www/your-domain/vendor/drush/drush/drush
Update database, if any required database updates are needed
drush updatedb or updb
Whereas, copying a remote database to a local best to use drush sql:sync command
drush sql:sync @dev @self
The command above copies the database from the site with the alias 'dev' to the local site alias 'self'.
Clear the cache
drush cache-rebuild or cr
Change the password of a user
drush user:password {username} "{password}"
Change {username} and {password} respectively.
drush user:password administrator "admin"
Related articles
Andrew Fletcher
•
04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher
•
26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher
•
17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...