简体   繁体   English

WP CLI 声称数据库需要修复,但 WP 本身可以工作

[英]WP CLI Claims DB Needs Repairing but WP Itself Works

I use wp-cli in my deploy/upgrade script.我在部署/升级脚本中使用 wp-cli。 I'm currently getting the following error from wp core is-installed (first command my script does with wp cli)我目前从wp core is-installed收到以下错误(我的脚本使用 wp cli 执行的第一个命令)

Error: One or more database tables are unavailable.错误:一个或多个数据库表不可用。 The database may need to be repaired.数据库可能需要修复。

So I ran mysqlcheck --all-databases --check --extended to see what the DB error was but it reports that all tables are OK!所以我运行了mysqlcheck --all-databases --check --extended来查看数据库错误是什么,但它报告所有表都正常!

Also, the site itself seems to work (can log in to admin, view pages, etc.) so it feels like this a wp-cli issue on the one hand, but coming from wp core or the DB on the other.此外,该站点本身似乎可以正常工作(可以登录管理员、查看页面等),因此一方面感觉这是一个 wp-cli 问题,但另一方面来自 wp 核心或数据库。

Does anyone have any ideas where I can start looking?有没有人有任何想法我可以开始寻找? Nothing in apache logs except some warnings that we always get.除了我们经常收到的一些警告外,apache 日志中没有任何内容。

Running WordPress 5.4.2 and wp-cli 2.4.0.运行 WordPress 5.4.2 和 wp-cli 2.4.0。 The first time the error came, we hadn't run the "upgrade" routine after updating WP version earlier, but I went in to admin and clicked "Upgrade Network".第一次出现错误时,我们在较早更新 WP 版本后没有运行“升级”例程,但我进入管理员并单击“升级网络”。 This succeeded but the cli still fails.这成功了,但 cli 仍然失败。

Database is 10.4.13-MariaDB and PHP version is 7.3.19.数据库为 10.4.13-MariaDB,PHP 版本为 7.3.19。 Running on CentOS Linux.在 CentOS Linux 上运行。

Checked the mariadb.log (thanks @nbk).检查了 mariadb.log(感谢@nbk)。 Nothing comes when running the site or the wp-cli command.运行站点或 wp-cli 命令时没有任何反应。 However, when i run the mysqlcheck command I get some errors like:但是,当我运行mysqlcheck命令时,会出现一些错误,例如:

[ERROR] InnoDB: index records in a wrong order in option_name of table myschema . [错误] InnoDB:表myschemaoption_name中的索引记录顺序错误。 wp_options

I think I'll try and export/re-import of the whole schema我想我会尝试导出/重新导入整个架构

It seems that the DB had somehow got a mixture of utf8 and utf8mb4 tables.似乎数据库以某种方式混合了 utf8 和 utf8mb4 表。 Not sure how.不知道怎么做。 I would speculate that it might be those created before and after upgrade of MariaDb version but not sure that's true.我推测它可能是在 MariaDb 版本升级之前和之后创建的,但不确定这是真的。 Anyway, we solved by exporting the whole schema, fixing the collations in the dump file and re-importing.无论如何,我们通过导出整个架构、修复转储文件中的排序规则并重新导入来解决。

If there's a bug, I'd say it's in the mysqlcheck command, which reported everything as OK, even while it was triggering errors in the mariadb.log about the records being malformed.如果有错误,我会说它在mysqlcheck命令中,它报告一切正常,即使它在 mariadb.log 中触发有关记录格式错误的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM