如何解决WordPress 出现错误:建立数据库连接时出错

今天访问帮朋友维护的wordpress官网, 出现错误: 建立数据库连接时出错.

本以为mysql服务挂了, 结果访问同服务器上的另一个网站没有问题, 估计是该网站的mysql出问题. 

登陆后台提示: 一些数据表不可用,也许需要修复数据库.

点击修复提示需在配置文件(wp-config.php)加选项:define(‘WP_ALLOW_REPAIR’, 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

刷新首页, 错误已排除, 已能正常显示.

相关推荐