How do you login to a Drupal site if you do not have the password of the admin user or user 1 but still have access to the command line? Can I use Drush to log in to the Drupal site?
You can log in to any Drupal site if you have access to the command line and Drush, knowing either the username
$ drush uli username --no-browser
OR the user ID.
$ drush uli --uid 123 --no-browser
This will return you an URL that you can copy paste into your browser address bar and login as that user. You can leave out the
--no-browser option when you want the command to directly launch the browser.