当我尝试重新索引Magento 1.7目录产品平面索引(通过管理面板或命令行)时出错。
在命令行上,我收到以下错误:
Product Flat Data index process unknown error: exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table 'databasename.#sql-340a_22a3' (errno: 121)' in /var/www/clients/client1/web16/web/lib/Zend/Db/Statement/Pdo.php:228
当我使用“SHOW ENGINE INNODB STATUS;
”查看mysql时,出现以下错误:
160830 10:17:09 Error in foreign key constraint creation for table `databasename`.`#sql-340a_2160`. A foreign key constraint of name `databasename`.`FK_MAGE_MAGE_CAT_PRD_FLAT_1_ENTT_ID_MAGE_CAT_PRD_ENTT_ENTT_ID` already exists. (Note that internally InnoDB adds 'databasename' in front of the user-defined constraint name.) Note that InnoDB's FOREIGN KEY system tables store constraint names as case-insensitive, with the MySQL standard latin1_swedish_ci collation. If you create tables or databases whose names differ only in the character case, then collisions in constraint names can occur. Workaround: name your constraints explicitly with unique names.
知道如何解决这个问题吗?
答案 0 :(得分:0)
在reindex
之前禁用foreign_key_checks
MySQL选项
SET foreign_key_checks = 0;
// job
SET foreign_key_checks = 1;