13

I entered the wrong admin password more than 5 times, so Drupal has blocked my entry.

I've change the user password directly in MySQL and then tried to login, but is still doesn't work. Also, if I click the request new password link, I don't get an e-mail.

How can I unblock my account?

14

To answer the question in your title (which appears to become more complicated following your actual question), you just need to clear the flood table in your database. If you're running Drush, then the following should sort you out:

drush php-eval 'db_query("DELETE FROM flood");'

Failing that, just clear the flood table from your database manually :)

  • That's awfully speedy for a friday afternoon Chappers, I'm starting to think you might not have been in the pub for most of the afternoon. Tsk, tsk. – Clive Feb 15 '13 at 16:05
  • @Clive In the pub? On a Friday afternoon? That'd be nice :-) – Chapabu Feb 15 '13 at 16:11
  • I thought friday drinking was mandatory now? Let me speak to my union rep... – Clive Feb 15 '13 at 16:14
  • 1
    Rats. To the propaganda room... – Clive Feb 15 '13 at 16:37
  • 3
    I wouldn't recommend to blindly delete all records of the flood table, this would reset all flood control for you website. – tostinni Feb 15 '13 at 18:51
7

Clearing the flood table will give the OP another 5 tries guessing the password. (And if he has messed with the password field directly in MySQL, the passord field may have become munged and therefore useless.)

Clearing the flood table will not allow him to login as admin, which is what I assume the OP actually want to do.

However, there are a couple of other drush commands that may be handy. The first will produce a one time password reset link for uid 1, the second sets a new password for user admin:

drush uli
drush upwd admin --password="newpassword"
  • Good catch! I even edited the question and didn't pick that up ;-) – Chapabu Feb 15 '13 at 16:23
6

If you are not much experienced with Drush kind of stuff, you can run the following sql in your phpmyadmin

DELETE FROM flood;

The same error can be happened if you tried same user name with 5 or more times

5

Much better solution, which is noticeably absent from other posts about this:

drush user-unblock {username}

https://drushcommands.com/drush-7x/user/user-unblock/

EDIT: this still doesn't clear the 'flood' table, unfortunately, which is dumb. As others have mentioned, to actually enable login after drush user-unblock in the case of a user being blocked by too many login attempts, you have to get into the database and truncate (dump all data from) the 'flood' table.

As others have mentioned when asking this question, this seems problematic in a production environment.

As usual, someone has already made a module that adds drush commands to clear out the flood table: https://www.drupal.org/project/flood_unblock

2

Just truncate the table flood

Truncate flood;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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