How to enable failed login profle on MySQL

Posted on

Question :

We are trying to implement failed_login profile for account lock on MySQL. didn’t find it on documentation.

Our version is 5.7.12.

Answer :

I don’t think MySQL supports database/logon triggers as other DBMS do. At least I couldn’t find anything about it in the docs. So that “usual way” is ruled out here.

But apparently you can do it via the general server log. Set the location of the log in your option file with

general_log_file = /where/you/want/it

and set

log_warnings = 2

. That will log warnings about unsuccessful logins.


general_log = 1

when you also want to log successful logins.

However be aware, that this will mean, that a lot of other stuff is logged too. It’s all just about raising or lowering log levels here, not specifically setting login related logging.

Leave a Reply

Your email address will not be published. Required fields are marked *