MySQL Event Help – Update column value for each row every 15 minutes

eventmysql-event

Okay so if I have a login database:

id | email | pass | attempts
----------------------------
 1 |  ""   |  ""  |    4
 2 |  ""   |  ""  |    2

Attempts marks the number of attempts made at logging in, per user. So user 1 has attempted to log in 4 times and user 2 has attempted to log in 2 times.

I was wondering if there was an event that I could add to my login database, which would reset all user attempts to 0? So after the reset, the table would look like this:

id | email | pass | attempts
----------------------------
 1 |  ""   |  ""  |    0
 2 |  ""   |  ""  |    0

Thanks !

Best Answer

Each hour:

CREATE EVENT reset ON SCHEDULE EVERY 1 HOUR DO UPDATE admin set aLoginAttempts = 0