mysql的general_log无限增大导致硬盘用尽、数据库崩溃后reapai table简单修复

网站发生奇怪问题,进入服务器查看了一下.htaccess文件(因为之前修改过这个文件,以为是它引起的),结果点击修改提示无法保存,关闭后发现居然内容空了!这什么鬼?再操作说硬盘空间不足!略一猜测感觉是某日志文件增大导致。查看mysqllog发现的确如此,

windows2008r2,mysql5.7,停止服务,清空日志文件,进入目录修改my.ini:

set global general_log=on;
改为
set global general_log=off;
启动服务,网站报错了。。
大致就是:
incorrect key file for table ‘.\wp_options.MYI…;try to repair it…
正准备在服务端修复,后来刷新页面又出来个wordpress自动修复页面:
先是列出一堆错误,之后写着:
To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file. Once this line is added to your config, reload this page.
define(‘WP_ALLOW_REPAIR’, true);
照做之后,刷新:

One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.
Repair Database
WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.

Repair and Optimize Database

点击了后者,然后:

部分错误被修复,还有部分需要手动修复:

wp_users: Table upgrade required. Please do “REPAIR TABLE `wp_users`” or dump/reload to fix it!

等等。

再进入服务器,打开myadmin(或者命令行窗口也行,我就是随便试下喽)

点击数据库,再点击sql命令,输入

repair table wp_users

显示结果OK。

再刷新刚才的修复页面,显示:

wp_users数据表正常。
    wp_users数据表已优化过了。
修复完成。请移除刚刚在wp-config.php中添加的那行代码,以防他人滥用本页面。

照做,再刷新网站,正常了。

就是个简单修复了,不知道还有没有其他内伤,有问题再找技术人员了。

 

作者:tactk,版权所有,如若转载,请注明出处:https://www.tacgeek.com/mysql-repair-1706.html

(0)
tactk的头像tactk
上一篇 2017-12-30
下一篇 2019-05-01

发表回复

登录后才能评论
企业微信
跳至工具栏