What to do when you locked yourself out of drupal


When you set site maintenance to offline, you lose the link to you login form as well. To get the login form, you need to do the following:

http://www.mysite.com/q=user
 or
http://www.mysite.com/user

Do not replace the word user with your username.

If this doesn’t work, log into you database and type the following SQL commands.

UPDATE variable SET value = 's:1:"0";' WHERE name= 'site_offline';
DELETE FROM cache WHERE cid = 'variables';

If you lost your mysql password, go to your drupal installation directory. Then navigate to sites/default. You should see a file by the name of settings.php. Open this file and look for a line which looks like the following.

mysql://username:password@localhost/databasename

Then type the following:

mysql -u username -p databasename

You will be prompted for you password. Once logged in type the SQL commands listed above.