1.1129 Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
環(huán)境:centos7.5? mysql8.1
報(bào)錯(cuò):Host IP is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
原因:同一個(gè)ip在短時(shí)間內(nèi)產(chǎn)生太多(超過(guò)mysql數(shù)據(jù)庫(kù)max_connection_errors的最大值)中斷的數(shù)據(jù)庫(kù)連接而導(dǎo)致的阻塞柳刮;
解決方法:
1、提高允許的max_connection_errors數(shù)量(治標(biāo)不治本):
① 進(jìn)入Mysql數(shù)據(jù)庫(kù)查看max_connection_errors: show variables like '%max_connection_errors%';
? ② 修改max_connection_errors的數(shù)量為1000: set global max_connect_errors = 1000;
∞忠③ 查看是否修改成功:show variables like '%max_connection_errors%';
2涝影、使用mysqladmin flush-hosts 命令清理一下hosts文件(不知道m(xù)ysqladmin在哪個(gè)目錄下可以使用命令查找:whereis mysqladmin)蜡感;
∩氪① 在查找到的目錄下使用命令修改:/usr/bin/mysqladmin flush-hosts -h192.168.1.1 -P3308 -uroot -prootpwd;
備注:
其中端口號(hào)笛粘,用戶名趁怔,密碼都可以根據(jù)需要來(lái)添加和修改远舅;
配置有master/slave主從數(shù)據(jù)庫(kù)的要把主庫(kù)和從庫(kù)都修改一遍的(我就吃了這個(gè)虧明明很容易的幾條命令結(jié)果折騰了大半天);
第二步也可以在數(shù)據(jù)庫(kù)中進(jìn)行痕钢,命令如下:flush hosts;
2.mysql8.0配置遠(yuǎn)程連接
用戶添加完成之后:連接工具連接報(bào)錯(cuò):
Error: 1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
解決方案進(jìn)入數(shù)據(jù)庫(kù)執(zhí)行以下命令:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密碼'