To reset the administrator password in Drupal 7 there is a script, which should be run by connecting via SSH
After connecting to the server, you need to determine where the script is. Its default path is in the root directory of the site scripts/scripts/password-hash.sh.
Change the directory to the root directory.
Run the script with the following command:
./scripts/password-hash.sh new password
where the new password is the one we want to set.
As a result of the script we get 2 values:
password - which denotes the password we set;
hash - which displays the result of the hashing function.
We need to save the value of the hash field.
Now we just need to put this value in the right field in the site database
Learn the name of the database with which the site works, you can in the configuration file settings.php, which is located in /sites/default/ from the root directory of the site.
Open this file, for example, via File Manager, and look for lines in it:
'database' => 'frnx_db', 'prefix' => ' ',
The values in these lines denote the name of the database the site works with, frnx_db and the database table prefix, which is not present in this case
After that, we need to get into the database itself, through phpMyAdmin in the MySQL section
Find the right database in the list and open it
In front of us is the database with which our site works. We need to find the table with the users of our site. Its name has the following form - Prefix_users. In our case it is called users
Table users, which contains information about all registered users of your site, you need to find the line with your account login and open it for editing by pressing Edit button.
To change your password, find the line with the name pass
- in the Value field insert our hash, which we have generated using the script.
Let's click the Forward button to save our changes.