Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Someone set up a website for me recently, using Drupal, and before I could get his admin credentials, I lost contact with him. Seeing as it's my web space, I do have access to the files and the database (which I have downloaded), however I can't get into the Drupal configuration.

Is there any way I can take over this Drupal installation or do I have to do a reinstall?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

If you have access to the database directly (through phpMyAdmin or some other means), you will have to execute a query to change the super-administrator password.

First, you will need an MD5 hash of the password you want to use. Go to this website, and type the text you want to use for the password, click the button, and you will be gifted with the MD5 hash string.

Next, log into your database. You'll need to execute the following query against your Drupal database to reset the admin username and password:

Query syntax may change slightly if you aren't using MySQL:

UPDATE `users` SET `name`='your login name',
`pass`='your password in MD5 hash form' WHERE `uid`=1;

You should be able to log with the admin credentials you specified at this point.

share|improve this answer

Heather has the right idea. Once you have access to the database you can change the password with a simple query. If you want to save one step from having to go to the MD5 website you could also use the MySQL builtin function with something like this:

UPDATE `users` SET `pass` = MD5('mynewpassword') WHERE `uid` =1;

Note: That only seems to work for Drupal sites <= version 6.x. If you are using version 7.x the MD5 hash will not work (I'm guessing it uses some sort of salt string on it). To reset the password on version 7.x you can just change the email address of the admin user to your email address with a query like this:

UPDATE users SET mail = 'myemail@mywebsite.com' WHERE uid = 1;

Once that is done you can go to the normal login page and just request a password reset, and it will be sent to your email address.

share|improve this answer
    
Ah, I was unaware MySql had a built in MD5 function! I haven't worked with Drupal 7 yet, that's a handy thing to know. +1 –  Heather Feb 4 '10 at 4:55

The easiest way to do this is to install drush and use the drush uli command. That will get you right in with a one-time link.

share|improve this answer
    
Welcome to SuperUser. While this answer may be a solution to the problem, lack of detail makes it hard to follow. –  harrymc Jun 17 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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