Drush have lots of useful commands for interacting with code like modules / themes
it can executes SQL queries and DB migrations, it can also run cron or clear cache.
Developers which is begginer level have not to worry using Drush because it can be able to understand Easy .
Developers which is intermidiate to advance level can be very useful specially for debugging purposes.
Here are the list of most usefull drush commands:
1. drush updb - Stands for "Update Databse", when the site has something went wrong or you delete the module that has enabled, just run this command to fix the issue.
2. drush cr --Stands for "Clear Cache", It is useful for creating twig files, css and js
3. drush uli - Stands for User Login, when you forgot youre admin username and password, you can use this command and it will show the url with of 1 time mix token login
. Ex http: // default / user / reset / 1/1601374003 / YFF4QQMPTNtzDI4UYyjVAMkV9pUjrMqKmRCrSiJWV84 / login, The replace {Youre_site} / user / reset / 1/1601374003 / YFF4QQMPTNtzDI4UYyjVAMkV9pUjrMqKmRCrSiJWV84 / login
4. drush php - This COMMAND Will run a php shell which accepts php scripts with drupal, this is useful for debugging backend logic or getting data from database using drupal php library
Ex. get email from user id 1
User = $ \ Drupal \ User \ Entity \ User :: Load (1);
$ Email = $ User-> GetEmail ();
print_r ($ Email);
5. drush sql:connect - This command is useful for importing or updating database from cloud to local
Example code :
Step 1: drush sql:cli
Step 2: mysql --user=drupaluser --password= --database=renify --host=127.0.0.1 --port=33067 -A
Step 3: source {db_name.sql}