在查找和替换工具中的 Moodle 中写入数据库时​​出错

Error writing to database in Moodle in Find and Replace tool

我已经从旧服务器 URLold= (https://example1.com) to new server URLnew=(https://example2.com) 移动了我的 moodle 数据库文件。现在我想使用 moodle 提供的查找和替换工具将数据库表中的 URLold 替换为 URLnew。但是当我执行操作时出现此错误。我应该怎么办?请帮忙。

我收到错误

Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table = REPLACE(table, 'https://example1.com', 'https://example2.com')' at line 1
UPDATE mdl_pma_history SET table = REPLACE(table, ?, ?)
[array (
0 => 'https://example1.com',
1 => 'https://example2.com',
)]
Error code: dmlwriteexception
Stack trace:
line 426 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 895 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 6787 of /lib/adminlib.php: call to mysqli_native_moodle_database->execute()
line 74 of /admin/tool/replace/index.php: call to db_replace()

所以我自己得到了答案

必须删除导致错误的 mdl_pma_history table。我遵循的步骤如下。

  • 将 table 导出到 .sql 文件
  • 删除了 table 因为它不允许脚本 运行
  • 一旦脚本(查找和替换)运行 成功导入 table 返回

完成。