今天访问维护的wordpress网站, 出现错误: 建立数据库连接时出错
本以为mysql服务挂了, 结果访问同服务器上的另一个网站没有问题,登陆后台提示: 一些数据表不可用,也许需要修复数据库。

点击修复数据库,提示需在配置文件(wp-config.php)加选项:define(‘WP_ALLOW_REPAIR’, true);
去wordpress的数据库配置配置文件(wp-config.php)添加如下代码:
PHP
define(‘WP_ALLOW_REPATR’,true);
1define(‘WP_ALLOW_REPATR’,true);
点击刚刚页面的“修复数据库”
下面是修复log日志:
————————————————–
wp_users 数据表正常。
wp_users 数据表已优化过了。
“wp_usermeta”数据表有问题。报告的问题是:1 client is using or hasn’t closed the table properly。WordPress 正在尝试进行修复…
无法修复 wp_usermeta 表。错误消息:1 client is using or hasn’t closed the table properly
“wp_posts”数据表有问题。报告的问题是:1 client is using or hasn’t closed the table properly。WordPress 正在尝试进行修复…
无法修复 wp_posts 表。错误消息:1 client is using or hasn’t closed the table properly
“wp_comments”数据表有问题。报告的问题是:85 clients are using or haven’t closed the table properly。WordPress 正在尝试进行修复…
无法修复 wp_comments 表。错误消息:85 clients are using or haven’t closed the table properly
wp_links 数据表正常。
“wp_options”数据表有问题。报告的问题是:Table is marked as crashed。WordPress 正在尝试进行修复…
无法修复 wp_options 表。错误消息:Table is marked as crashed
“wp_postmeta”数据表有问题。报告的问题是:1 client is using or hasn’t closed the table properly。WordPress 正在尝试进行修复…
无法修复 wp_postmeta 表。错误消息:1 client is using or hasn’t closed the table properly
wp_terms 数据表正常。
wp_term_taxonomy 数据表正常。
wp_term_relationships 数据表正常。
wp_commentmeta 数据表正常。
部分数据库问题无法修复。请复制下列错误信息,前往 WordPress 支持论坛寻求帮助。
wp_usermeta: 1 client is using or hasn’t closed the table properly
wp_posts: 1 client is using or hasn’t closed the table properly
wp_comments: 85 clients are using or haven’t closed the table properly
wp_options: Table is marked as crashed
wp_postmeta: 1 client is using or hasn’t closed the table properly
修复完成。请移除刚刚在wp-config.php中添加的那行代码,以防他人滥用本页面。
PHP
define(‘WP_ALLOW_REPAIR’, true);
1define(‘WP_ALLOW_REPAIR’,true);
完成数据库表的修复,网站就恢复正常了。
本文介绍了一种WordPress网站遇到的数据库连接错误及解决方法。通过在配置文件中添加特定代码实现数据库修复功能,并记录了修复过程及遇到的问题。
2547

被折叠的 条评论
为什么被折叠?



