1

I am trying to reindex Category Flat Data via ssh with the command php indexer.php --reindex catalog_category_flat but I am getting error as below. I have tried all the solutions posted on the forum but I am not able to fix the issue. Can you look into the error log and let me know if there is any way to fix the issue?

[cpanelusername@server shell]$ php indexer.php --reindex catalog_category_flat
Category Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table 'cpanelusername_magento.catalog_category_flat_store_1' (errno: -1)' in /home/cpanelusername/public_html/catalog/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/cpanelusername/public_html/catalog/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/cpanelusername/public_html/catalog/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/cpanelusername/public_html/catalog/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/cpanelusername/public_html/catalog/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/cpanelusername/public_html/catalog/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('CREATE TABLE `c...', Array)
#5 /home/cpanelusername/public_html/catalog/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('CREATE TABLE `c...', Array)
#6 /home/cpanelusername/public_html/catalog/lib/Varien/Db/Adapter/Pdo/Mysql.php(2039): Varien_Db_Adapter_Pdo_Mysql->query('CREATE TABLE `c...')
#7 /home/cpanelusername/public_html/catalog/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php(604): Varien_Db_Adapter_Pdo_Mysql->createTable(Object(Varien_Db_Ddl_Table))
#8 /home/cpanelusername/public_html/catalog/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php(1418): Mage_Catalog_Model_Resource_Category_Flat->_createTable('1')
#9 /home/cpanelusername/public_html/catalog/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php(1431): Mage_Catalog_Model_Resource_Category_Flat->_createTables()
#10 /home/cpanelusername/public_html/catalog/app/code/core/Mage/Catalog/Model/Category/Indexer/Flat.php(246): Mage_Catalog_Model_Resource_Category_Flat->reindexAll()
#11 /home/cpanelusername/public_html/catalog/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Category_Indexer_Flat->reindexAll()
#12 /home/cpanelusername/public_html/catalog/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#13 /home/cpanelusername/public_html/catalog/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#14 /home/cpanelusername/public_html/catalog/shell/indexer.php(198): Mage_Shell_Compiler->run()
#15 {main}

I dont have any DB table called cpanelusername_magento.catalog_category_flat_store_1

2
  • What have you tried exactly? See the first error in this link.
    – nevvermind
    Commented Apr 14, 2014 at 17:18
  • Thanks. If a foreign key constraint was not correctly formed how can I fix it. I have already tried repairing the DB?
    – Kevin S
    Commented Apr 21, 2014 at 13:48

2 Answers 2

3

I had the same problem and found the solution.

Tables catalog_category_entity and core_store were MyISAM instead of InnoDB.

Check these two tables in your database and if they are MyISAM instead of InnoDB, run these SQL statements:

ALTER TABLE catalog_category_entity ENGINE=INNODB;
ALTER TABLE core_store ENGINE=INNODB;
1

My issue was something else not posted anywhere. I solved the issue by exporting the database and importing it to new database name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.