gpt4 book ai didi

php - 如何在 MySQL 中忽略表和更改 ID?

转载 作者:可可西里 更新时间:2023-11-01 07:36:28 25 4
gpt4 key购买 nike

我在我的网站上安装了插件后出现了以下错误信息。我想知道要运行什么查询才能解决 MYSQL/PhpMyadmin 的这个问题?

Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: 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 'IGNORE TABLE
`xf_trophy_category` DROP PRIMARY KEY , CHANGE `trophy_category_id`'
at line 1 - library/Zend/Db/Statement/Mysqli.php:77

更新。

这是堆栈跟踪。我已经问过插件开发人员,但他们没有处理它。

0 /home/admin/web/.com/public_html/library/Zend/Db/Statement.php(115):

Zend_Db_Statement_Mysqli->_prepare('ALTER IGNORE TA...')

1 /home/admin/web/.com/public_html/library/Zend/Db/Adapter/Mysqli.php(381):

Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'ALTER IGNORE TA...')

2 /home/admin/web/.com/public_html/library/Zend/Db/Adapter/Abstract.php(478):

Zend_Db_Adapter_Mysqli->prepare('ALTER IGNORE TA...')

3 /home/admin/web/.com/public_html/library/Waindigo/Install/20150313.php(758):

Zend_Db_Adapter_Abstract->query('ALTER IGNORE TA...')

4 /home/admin/web/.com/public_html/library/Waindigo/Install/20150313.php(216):

Waindigo_Install->_makeTableChanges(Array)

5 /home/admin/web/.com/public_html/library/Waindigo/Install/20150313.php(88):

Waindigo_Install->_install(Array, Object(SimpleXMLElement))

6 /home/admin/web/.com/public_html/library/XenForo/Model/AddOn.php(214):

Waindigo_Install::install(false, Array, Object(SimpleXMLElement))

7 /home/admin/web/.com/public_html/library/XenForo/Model/AddOn.php(169):

XenForo_Model_AddOn->installAddOnXml(Object(SimpleXMLElement), false)

8 /home/admin/web/.com/public_html/library/XenForo/ControllerAdmin/AddOn.php(188):

XenForo_Model_AddOn->installAddOnXmlFromFile('/home/admin/tmp...')

9 /home/admin/web/.com/public_html/library/XenForo/FrontController.php(351):

XenForo_ControllerAdmin_AddOn->actionInstall()

10 /home/admin/web/.com/public_html/library/XenForo/FrontController.php(134):

XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))

11 /home/admin/web/.com/public_html/admin.php(13): XenForo_FrontController->run()

12 {main}

最佳答案

插件与 MySQL 5.7 不兼容,或者编写代码的人显然没有意识到 ALTER IGNORE在 MySQL Server 5.6 中已弃用,并已在 MySQL Server 5.7 中完全删除。这总是一个坏主意,因为它促进了草率的数据库管理。

IGNORE is a MySQL extension to standard SQL. It controls how ALTER TABLE works if there are duplicates on unique keys in the new table or if warnings occur when strict mode is enabled. If IGNORE is not specified, the copy is aborted and rolled back if duplicate-key errors occur. If IGNORE is specified, only one row is used of rows with duplicates on a unique key. The other conflicting rows are deleted. Incorrect values are truncated to the closest matching acceptable value.

As of MySQL 5.6.17, the IGNORE clause is deprecated and its use generates a warning. IGNORE is removed in MySQL 5.7.

https://dev.mysql.com/doc/refman/5.6/en/alter-table.html

错误指的是the correct syntax to use near 'IGNORE ...' ,服务器告诉你 IGNORE遇到无效的地方。之前的一切都被正确解析,之后的一切可能是正确的,也可能是错误的,但这不能确定,因为遇到了意想不到的事情。

如果我没看错你的堆栈轨迹,它就在这里:

3 
/home/admin/web/.com/public_html/library/Waindigo/Install/20150313.php(758):
Zend_Db_Adapter_Abstract->query('ALTER IGNORE TA...')

去掉IGNORE这个词来自 Waindigo/Install/20150313.php第 758 行,以便它开始 ALTER TABLE ... .

关于php - 如何在 MySQL 中忽略表和更改 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44858311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com