<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/post//</link>
<title><![CDATA[MySql Host is blocked because of many connection errors; unblock with mysqladmin flush-hosts 解决方法]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[数据库]]></category>
<pubDate>Mon, 04 Jan 2016 02:56:34 +0000</pubDate> 
<guid>https://www.heckjj.com/post//</guid> 
<description>
<![CDATA[ 
	<p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px"><strong>环境：</strong>linux，mysql5.5.21</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px"><strong>错误：</strong>Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px"><strong>原因：</strong></p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　同一个ip在短时间内产生太多（超过mysql数据库max_connection_errors的最大值）中断的数据库连接而导致的阻塞；</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px"><strong>解决方法：</strong></p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">1、提高允许的max_connection_errors数量（治标不治本）：</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　① 进入Mysql数据库查看max_connection_errors：&nbsp;<span style="line-height: 1.5; color: #ff0000"><strong>show variables like '%max_connection_errors%';</strong></span></p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px"><span style="line-height: 1.5; color: #ff0000"><strong>　 &nbsp;&nbsp;</strong><span style="line-height: 1.5; color: #000000">② 修改max_connection_errors的数量为1000：&nbsp;<span style="line-height: 1.5; color: #ff0000"><strong>set global max_connect_errors = 1000;</strong></span></span></span></p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px"><span style="line-height: 1.5; color: #ff0000"><span style="line-height: 1.5; color: #000000">　　③ 查看是否修改成功：<span style="line-height: 1.5; color: #ff0000"><strong>show variables like '%max_connection_errors%';</strong></span></span></span></p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">2、使用<span style="line-height: 1.5; color: #ff0000"><strong>mysqladmin flush-hosts&nbsp;</strong></span>命令清理一下hosts文件（不知道mysqladmin在哪个目录下可以使用命令查找：<span style="line-height: 1.5; color: #ff0000"><strong>whereis mysqladmin</strong></span>）；</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　① 在查找到的目录下使用命令修改：/usr/bin/<strong>mysqladmin flush-hosts -h192.168.1.1</strong>&nbsp;-P3308&nbsp;<strong>-uroot</strong>&nbsp;-prootpwd;</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　备注：</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　　　其中端口号，用户名，密码都可以根据需要来添加和修改；</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　　　配置有master/slave主从数据库的要把主库和从库都修改一遍的（我就吃了这个亏明明很容易的几条命令结果折腾了大半天）；</p><p style="margin: 10px auto; color: #4b4b4b; font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.2000007629395px">　　　　第二步也可以在数据库中进行，命令如下：<span style="line-height: 1.5; color: #ff0000"><strong>flush hosts;</strong></span></p><br/>Tags - <a href="https://www.heckjj.com/tags/mysql/" rel="tag">mysql</a> , <a href="https://www.heckjj.com/tags/mysqladmin/" rel="tag">mysqladmin</a> , <a href="https://www.heckjj.com/tags/flush-hosts/" rel="tag">flush-hosts</a> , <a href="https://www.heckjj.com/tags/host/" rel="tag">host</a> , <a href="https://www.heckjj.com/tags/locked/" rel="tag">locked</a> , <a href="https://www.heckjj.com/tags/unblock/" rel="tag">unblock</a> , <a href="https://www.heckjj.com/tags/max_connection_errors/" rel="tag">max connection errors</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/post//#blogcomment</link>
<title><![CDATA[[评论] MySql Host is blocked because of many connection errors; unblock with mysqladmin flush-hosts 解决方法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>