3

Have an old VM with Drupal configured on it, and I can't recall the admin password. The password-recovery process sent me a link to reset the password, but the page generated said "Access Denied".

I then tried directly editing the Drupal users table in MySQL. This would have worked, except for the fact that the Salt module was installed and therefore the hash was invalid.

I'm not sure where to go from here; any ideas?

3
  • Can you provide a link to the download site for salt module you are using? I saw a couple different ones when I did a search.
    – Zoredache
    Jan 20, 2010 at 0:18
  • drupal.org/project/salt Jan 20, 2010 at 14:50
  • Ended up rebuilding the VM; there wasn't enough data on it to make it worth the time I was spending trying to break back in. Thanks for the suggestions. Jan 23, 2010 at 3:51

4 Answers 4

1

It seems you already solved the problem but here is an answer anyhow. Connect to the mysql database and do the following:

  • select value from variable where name='salt';
  • update users set pass=md5('newpassSALT') where uid=1; Where SALT is the value noted above.

The password should be reset to "newpass".

2
1

I had no luck with the MD5('newpassSALT') method described in the accepted answer, so here's what worked for me. Note that you need to substitute your own values for the following:

  • /var/www/path/to/drupal : the location your Drupal is installed
  • mynewpassword : your desired password
  • drupaluser : the drupal database user
  • drupaldb :the drupal database schema

Step by step:

# cd /var/www/path/to/drupal
# scripts/password-hash.sh "mynewpassword"
password: mynewpassword     hash: $S$C/mWw8UGcAyCwLDOiqRBOShJl8w2vVLsSzYvqCMuAg/LSncU16Iy

# mysql -u drupaluser -p
enter your password:

mysql> use drupaldb
Database changed
mysql> update users set pass='$S$C/mWw8UGcAyCwLDOiqRBOShJl8w2vVLsSzYvqCMuAg/LSncU16Iy' where uid=1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> commit;
Query OK, 0 rows affected (0.00 sec)
2
  • I assume this is on a new drupal 7 install? The newpassSALT solution is specifically for an old drupal install with the "SALT" module installed.
    – Craig
    Feb 19, 2011 at 0:20
  • +1, this one really works for Drupal 7, thanks for sharing the hash for mynewpassword! Simply updating the appropriate record (for the user whose password I want to change) in phpMyAdmin with the hash you wrote, and then logging in with the appropriate username and mynewpassword works. Of course, this password should be changed after logging in immediately. :) (By the way, the simple MD5-methods in other answers only worked for <= Drupal 6. Drupal 7 doesn't use this "simple" password storing method anymore.)
    – Sk8erPeter
    Nov 25, 2013 at 13:26
0

Do you have a second non-admin account on your drupal system that does work? Is it also using the slated password? Are you able to directly edit the mysql table and copy the password from an known account to the admin account?

2
  • I have a non-admin account, it suffers from the same problems. I can directly edit the mysql table, but I don't know how to recreate a salted value in order to sign in again; simply using "pass = md5('password')" doesn't work. Jan 19, 2010 at 21:16
  • Also, I tried moving the salt folder out of the sites/all/modules directory, to no effect. Jan 19, 2010 at 21:17
0

Your ending the wrong database! The mysql.user table is specifically for mysql accounts to access Drupal's database. If drupal is saying "access denied" then it probably has access to its database and you forgot drupal's admin password. I highly reccomend using phpMyAdmin for this.

1. Login to phpMyAdmin
2. Select the database which Drupal use from the drop-down menu on the left.
4. Click on the SQL tab.
5. In the text field on the page type the following text:
update users set pass=md5('NEWPASS') where uid = 1;

the uid of 1 is the admin, you can change the passwords used by other users by changing the uid in this query.

1
  • I misspoke; I meant the <drupaldb>.users table. This is what was done, but it did not correct the issue, due to the salt. Jan 24, 2010 at 16:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .