There are several methods to recover the Drupal administrator ("user 1") password. DrupalConsole and drush provide commands to recover and manage users passwords. If you do not use DrupalConsole or drush you can recover the password via mail.
Recover password with DrupalConsole
DrupalConsole offers several ways of recovering the administrator's password.
DrupalConsole can generate a one-time login link.
Clear login failed attempts for an account.
Recover password with Drush
Drush offers several ways of recovering the administrator's password.
Drush can generate a one-time login link.
drush upwd --password="givememypasswordback" "admin"
(where "admin" is the user name)
Depending on your environment or hosting provider, you may or may not be able to use certain special characters as part of your username or password. For example on Pantheon, Pantheon SSH (which both Terminus and Drush @pantheon aliases use) explicitly rejects any command string that contains certain characters in any position, regardless of quoting or escaping.
The excluded characters are:
Change password with a database query
Drupal 6 and below
Execute the following query on the Drupal database where 'givememypasswordback' is your new password. You will need to log into your database using phpMyAdmin or another tool.
UPDATE users SET pass = MD5('givememypasswordback') WHERE uid=1;
Request new password via e-mail
You can reset your password by requesting a new password at