how to regain access to your drupal site when you've locked yourself out

Joeri Poesen //

There are a number of scenarios that can lead to a Drupal admin being locked out of his own site. One of them is not remembering his password.

Another possibility is putting the site in offline mode and logging out. Once logged out you have no way of getting access to the login screen so you’re fracked.

Solution:

UPDATE variable set site_offline = 's:1:"0"';

UPDATE:
a certain wiseass let me know that although /user/login will redirect you to the “offline” page, /user will actually allow you to log in. Respect, Big B.