<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">经常遇到discuz站长提到数据表“使用中”造成论坛无法正常访问</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<br />

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">这个原因是myisam的表数据太多,在某个时刻, 存放数据的这个MyISAM表数据急速长大。</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<br />

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">&nbsp;比如一些log表, 当硬盘写满了.这个时候还在继续写.然后这个表就会lock掉;</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">或者是mysiam的存储表的文件tbl_name.MYI 损坏了,</span><span style="line-height:1.5;font-family:'Microsoft YaHei';font-size:16px;">表现在你用phpmyadmin打开这个数据库的时候. 该MyISAM表的下面几个字段显示“使用中”</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">如图:</span>

</p>
<p>

<a href="http://img.himy2.com/wp-content/uploads/2014/09/QQ%E5%9B%BE%E7%89%8720140907233026.jpg"><img src="http://img.himy2.com/wp-content/uploads/2014/09/QQ%E5%9B%BE%E7%89%8720140907233026.jpg" alt="QQ图片20140907233026" width="1064" height="119" class="alignnone size-full wp-image-205" /></a>

</p>
<p>

<br />

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<br />

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">百度后查到的解决办法:</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">SSH登陆服务器</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">切换到数据库的数据路径,</span><span style="line-height:1.5;font-family:'Microsoft YaHei';font-size:16px;">如:</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">cd /data/msyql/数据库名</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">然后输入:</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">myisamchk -r &lt;table_name&gt;</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">如上面的例子为</span><span style="font-family:'Microsoft YaHei';font-size:16px;">pre_forum_post</span><span style="font-family:'Microsoft YaHei';font-size:16px;">表坏了,则输入</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">myisamchk</span><span style="font-family:'Microsoft YaHei';font-size:16px;">&nbsp;-r&nbsp;</span><span style="font-family:'Microsoft YaHei';font-size:16px;"></span><span style="font-family:'Microsoft YaHei';font-size:16px;">pre_forum_post</span><span style="font-family:'Microsoft YaHei';font-size:16px;"></span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;color:#FF9900;">(以上方法已验证</span><span style="font-family:'Microsoft YaHei';font-size:16px;color:#FF9900;">)</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<br />

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">如果这样还是不能解决, 停掉mysql,然后</span>

</p>
<p style="color:#333333;font-family:Arial;font-size:14px;background-color:#FFFFFF;">

<span style="font-family:'Microsoft YaHei';font-size:16px;">myisamchk -r -v -f &lt;table_name&gt;</span>

</p>
<span style="font-family:'Microsoft YaHei';font-size:16px;"></span><span></span>
<p>

<br />

</p>
<p>

<span style="font-family:'Microsoft YaHei';font-size:16px;">修复后:</span>

</p>
<p>

<a href="http://img.himy2.com/wp-content/uploads/2014/09/QQ%E5%9B%BE%E7%89%8720140907233030.jpg"><img src="http://img.himy2.com/wp-content/uploads/2014/09/QQ%E5%9B%BE%E7%89%8720140907233030.jpg" alt="QQ图片20140907233030" width="1111" height="120" class="alignnone size-full wp-image-206" /></a>

</p>

Last modification:December 13th, 2017 at 11:43 pm