Mysql – disable an account in thesql after x failed login attempts

loginsMySQLmysql-5.5Security

I would like to disable accounts after x failed login attempts. Is it possible?

Best Answer

Also you can use fail2ban for this goal as too easily way . In this case you just install it on you linux OS, then enable the section for [mysqld-iptables] in the /etc/fail2ban/jail.local.

[mysqld-iptables]
enabled  = true
filter   = mysqld-auth
action   = iptables[name=mysql, port=3306, protocol=tcp]
       sendmail-whois[name=MySQL, dest=root, sender=fail2ban@example.com]
logpath  = /var/log/mysqld.log
maxretry = 5

This program check the mysql logs by its own given pattern and then blocks the IP addresses which they try to login more than 5 times, in iptables.