Today I had to configure a MySQL database cluster and I faced the following error
ERROR 1129 (HY000): Host '192.168.1.12' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
while I was trying to access a MySQL instance via HaProxy. After some searching in dba.stackexchange.com, I found that my failed connection attempts had surpassed the max_connect_errors variable which is set by default to 10. In order to be able to connect to the cluster again you have to follow these steps in every MySQL server that belongs to the cluster:
- Open a command prompt (or shell in Linux) with administrative privilleges
- If you are in Windows set character set to unicode. Linux is using UTF-8 by default.
- Flush all hosts in MySQL using mysqladmin:
mysqladmin flush-hosts -u root -p
- Open my.cnf (Linux) or my.ini (Windows) and change max_connect_errors variable to a large number. I used:
- Restart MySQL server
Linux: sudo /etc/init.d/mysql restart Windows: net stop mysql net start mysql
You are done!