首页 文章

Magento 2 SQLSTATE [HY000]:常规错误:1823无法添加外键约束

提问于
浏览
0

大家好,我的Magento 2商店出现了错误 . 例如失败的API请求,Swagger提供500,Stylesheets和JS文件将无法加载等 .

最后,我发现使用新鲜主题文件创建新Magento安装的最佳解决方案,只需从文件中复制 pub/media 并使用维护模式删除所有以 customers_catalog_sales_eav_ 为前缀的表

这一步使我的新店工作得非常好,但我遇到了新的错误..我无法运行 setup:upgrade 它显示的消息:

[PDOException] SQLSTATE[HY000]: General error: 1823 Failed to add the foreign key constraint 'porosec_pororom/CAT_CTGR_PRD_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID' to system tables

运行 php -f bin/magento setup:db-schema:upgrade 时出错

发出以前消息的命令

当我运行 composer update 时,它会更新许多依赖项,但它需要运行 setup:upgrade .

Swagger Error 500

{“0”:“请升级您的数据库:从Magento根目录运行\”bin / magento setup:upgrade \“ . \ n以下模块已过时:\ n \ nKlarna_Core数据:当前版本 - 4.1.5,所需版本 - 4.2.3 \ nKlarna_Ordermanagement数据:当前版本 - 4.1.2,必需版本 - 4.1.3“,”1“:”#0 /home/porosec/public_html/test/vendor/magento/framework/Interception/Interceptor.php( 121):Magento \ Framework \ Module \ Plugin \ DbStatusValidator-> beforeDispatch(对象(Magento \ Framework \ App \ FrontController \ Interceptor),对象(Magento \ Framework \ App \ Request \ Http))\ n#1 / home / porosec /public_html/test/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73):Magento \ Framework \ App \ FrontController \ Interceptor-> Magento \ Framework \ Interception \ (Object (Magento \ Framework \ App \ Request \ Http))\ n#2 /home/porosec/public_html/test/vendor/magento/framework/Interception/Interceptor.php(135):Magento \ PageCache \ Model \ App \ FrontController \ BuiltinPlugin-> aroundDispatch(对象(Magento的\弗拉mework \ App \ FrontController \ Interceptor),Object(Closure),Object(Magento \ Framework \ App \ Request \ Http))\ n#3 / home / porosec / public_html / test / vendor / magento / framework / Interception / Interceptor . php(153):Magento \ Framework \ App \ FrontController \ Interceptor-> Magento \ Framework \ Interception \ (对象(Magento \ Framework \ App \ Request \ Http))\ n#4 / home / porosec / public_html / test / generated / code / Magento / Framework / App / FrontController / Interceptor.php(26):Magento \ Framework \ App \ FrontController \ Interceptor - > ___ callPlugins('dispatch',Array,Array)\ n#5 / home / porosec /public_html/test/vendor/magento/framework/App/Http.php(135):Magento \ Framework \ App \ FrontController \ Interceptor-> dispatch(Object(Magento \ Framework \ App \ Request \ Http))\ n#6 /home/porosec/public_html/test/generated/code/Magento/Framework/App/Http/Interceptor.php(24):Magento \ Framework \ App \ Http-> launch()\ n#7 / home / porosec / public_html /test/vendor/magento/framework/App/Bootstrap.php(256):Magento \ Framework \ App \ Http \ Interceptor-> launch()\ n#8 / home / poros ec / public_html / test / index.php(39):Magento \ Framework \ App \ Bootstrap-> run(对象(Magento \ Framework \ App \ Http \ Interceptor))\ n#9 “,”url“: “/test/swagger","script_name":"/test/index.php”}

Swagger Error log

这也是我在管理仪表板中得到的

Admin Panel error

[2018-06-04 23:18:09] main.CRITICAL: Report ID: webapi-5b15c8b17792e; Message: Class "array" does not exist. Please note that namespace must be specified. {"exception":"[object] (Exception(code: 0): Report ID: webapi-5b15c8b17792e; Message: Class \"array\" does not exist. Please note that namespace must be specified. at /home/porosec/public_html/test/vendor/magento/framework/Webapi/ErrorProcessor.php:205, LogicException(code: 0): Class \"array\" does not exist. Please note that namespace must be specified. at /home/porosec/public_html/test/vendor/magento/framework/Reflection/TypeProcessor.php:139)"} []

Admin Panel error log

1 回答

  • 0

    如果你已经采取了相同的表的备份,如果外键约束与bkp表和当前表相同,则mysql将抛出异常,因此更改约束名称或删除现有约束 .

    约束名称不应该相同 .

相关问题