Mysql数据库常见故障

Mysql数据库常见故障

1.报错现象

Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

2.解决方法

1、提高允许的max_connection_errors数量(治标不治本):

  ① 进入Mysql数据库查看max_connection_errors: show variables like '%max_connection_errors%';

    ② 修改max_connection_errors的数量为1000: set global max_connect_errors = 1000;

  ③ 查看是否修改成功:show variables like '%max_connection_errors%';

2、使用mysqladmin flush-hosts 命令清理一下hosts文件(不知道mysqladmin在哪个目录下可以使用命令查找:whereis mysqladmin);
    
    ① 在查找到的目录下使用命令修改:mysqladmin  -u  root  -p  flush-hosts;

3、修改mysql配置文件,在[mysqld]下面添加 max_connect_errors=1000,然后重启mysql

本文来自博客园,作者:白日梦想家Zz,转载请注明原文链接:https://www.cnblogs.com/zzlain/p/5993531.html

原文地址:https://www.cnblogs.com/zzlain/p/5993531.html