这些天,连接MySql出现了
Host is blocked because of many connection error” In MySQL的问题,从网上搜索了一些解决方式,现记录如下:
Today, I got following MySQL error in a PHP application: Host ‘host_name’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’. It means that mysqld has received many connection requests from the given host. Default max_connect_errors value is 10, that is remote host will be blocked if there is more than 10 connection errors.
To fix, type the following command
# mysqladmin flush-hosts
To avoid this happening again, edit my.cnf
# vi /etc/my.cnf
Add the following line
max_connect_errors=10000
The value of the max_connect_errors system variable determines how many successive interrupted connection requests are permitted. Restart MySQL to reload configuration file
# service mysqld restart
Or, the value ‘max_connect_errors’ can also be set at runtime, type the following commands
# mysql -uroot -p # mysql> SET GLOBAL max_connect_errors=10000;