Last updated March 20, 2012. Created by LeeHunter on March 2, 2006.
Edited by rvanderh1, bekasu, John Morahan, sepeck. Log in to edit this page.
Say you accidentally "block" your admin account and cannot log in. From within a MySQL client you can run this command to unblock it
update users set status = 1 where uid = 1;
Locked Out
This may be really basic, but I can imagine it happening to other people, so... Since the first person to login to a fresh Drupal installation has full administrative privileges, the first time I installed Drupal, I felt some urgency in locking down the site. After installation, I added a couple regular user accounts with less god-like powers. Under administer->access controls, I added rules to allow these specific users, and then added a rule to deny all users (except these specifically allowed users). I had assumed that the special account with uid=1 would be exempt. Wrong. As soon as I clicked the button, I found myself locked out from my own site. I then wished I had an undo button.
The equivalent of the undo button is to kill that last rule from the access table in the database. Using the MySQL monitor, you can look at the access table:
mysql> select * from access;
yields something like:
+-----+-------+------+--------+
| aid | mask | type | status |
+-----+-------+------+--------+
| 1 | bobby | user | 1 |
| 2 | peter | user | 1 |
| 3 | greg | user | 1 |
| 4 | alice | user | 1 |
| 5 | % | user | 0 |
+-----+-------+------+--------+To kill that last rule, you can:
delete from access where aid='5';
The right way to have done this would have been to add the uid=1 superadmin account to the list of authorized users before setting the rule to deny all users. Live and learn, eh?