3

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?

raven
  • 5,435

3 Answers3

5

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.

quickcel
  • 4,919
2

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.

0

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.

For example:

drush uli -l mydomain.com

You could also log in as a specific user with:

drush uli -l mydomain.com joe_user

Note that the -l option is not required if your site has a base_url set.

Drush is a command-line interface for Drupal that provides several very handy capabilities. See https://github.com/drush-ops/drush for information on obtaining and using drush.

TIH
  • 11