To reset the administrator password in Drupal 8 there is a script, which should be run by connecting via SSH

After connecting to the server it is necessary to determine where the script lies. Its default path is in the root directory of the site scripts/


Change the directory to the root directory.

cd /var/www/www-root/data/www/  

Run the script with the following command:

./core/scripts/ NewPass

Where NewPass is the new password that we want to set.


As a result of the script we get 2 values:

  • password - in which the password we set is marked;
  • hash - which displays the result of the hashing function.

We need to save the hash field value.


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 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 absent 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_field_data. In our case it is called users_field_data


Table users_field_data, 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.

Updated Aug. 27, 2019