Drupal - Reset user's password in mariadb console

To reset the password of a certain user in Drupal, you can go directly to the mariadb console and update the hashed password for that user.

1. First create a hashed password by running the following Drupal's script:

$ cd /path/to/drupal/root
$ ./scripts/password-hash.sh "Mynewpassw0rd"

password: Mynewpassw0rd                 hash: $S$DaV2cH0vn1Sxg71dLnN9NYE2B4acIWn94toMR3ign2CGHMXxmBQd


2. Go to mysql console and update user 'myuser' password:

$ mysql -u dbadmin -p
Password: ****

MariaDB > USE mydb;
MariaDB [mydb] > UPDATE users SET pass='$S$DaV2cH0vn1Sxg71dLnN9NYE2B4acIWn94toMR3ign2CGHMXxmBQd' WHERE name='myuser';


3. Done

Comments