0

I was doing a Media module tutorial. Half way through it I decided to install the tutorial companion files and foolishly replaced my files. In the companions readme it says the admin login is username - admin and password - admin.

But it is not! Now i’m completely locked out. Can someone tell me how I might break in to my tutorial site? I have access to the DB via PHPMyAdmin.

I was thinking a MySQL update command to the password field for the admin. Can someone tell me what I could use to reset the admin password?

I changed the admin email address then requested a new password but it has not fired off an email. I believe the password encryption method is sha1().

1
  • One more suggestion, if you have a running drupal site, open its database (for ex. with PhpMyAdmin), open users table, copy admin's encrypted password, put it into yours.. this should work.
    – xurshid29
    Commented Oct 22, 2014 at 6:06

3 Answers 3

5

If you're using Linux:

  1. Install drush if you haven't already
  2. Go to /install_directory/sites/mysite
  3. Type sudo drush uli
  4. Copy the link to your browser

Drush is extremely useful for many things. The above will log you in as user 1, after which you can reset your password in the usual way.

3
  • Or do what J. Reynolds suggests, quicker, easier, doesn't require command line access... but then you still won't have drush =)
    – Darvanen
    Commented Oct 22, 2014 at 4:33
  • there was an error in that it could not output the host name, it had default/user/etc.... so i just replaced defualt w/ hostname and it worked. thanks
    – TopTomato
    Commented Oct 22, 2014 at 13:47
  • It gets the host name from your settings file. If you haven't set $base_url it will just give you the site folder name.
    – Darvanen
    Commented Sep 17, 2015 at 0:02
2

Look at this post: Resetting the administrator password with sql-query (Drupal 7)

When, in Drupal 7, the password for user 1 (the administrator) is lost and the email notification or drush methods don't work, it is possible to set the password via a database query.

I have done it in the past using a PHP script (it provides the link to that post in above post).

The password reset method described below uses a PHP script that must be uploaded to the web server to reset the administrator password. The ability to upload a PHP file to the server where the site is hosted is required for successful execution of this method.

And it is always prudent to make a backup of the database before making any unconventional changes to it.

1
  • before doing any thing with database just take a backup of database. Commented Dec 12, 2014 at 13:20
0

A little late to the game, but the simplest solution for me would be:

  1. Go to the user database table
  2. Change the email of the "admin" user (Remember to save the original email.)
  3. Go to yoursite.com/user/password and reset your password.
  4. Change the email back to the original one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.