I started getting this error suddenly and I checked and the table does exist. I'm not sure how to start fixing this issue. I have attached a picture below:

enter image description here

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_e.catalog_category_flat_store_1' doesn't exist, query was: SELECT main_table.entity_id, main_table.name, main_table.path, main_table.is_active, main_table.is_anchor, url_rewrite.request_path FROM catalog_category_flat_store_1 AS main_table LEFT JOIN url_rewrite ON url_rewrite.entity_id = main_table.entity_id AND url_rewrite.is_autogenerated = 1 AND url_rewrite.store_id = 1 AND url_rewrite.entity_type = 'category' WHERE (main_table.is_active = 1) AND (main_table.path like '1/2/15/%') AND (level <= 3) ORDER BY main_table.position ASC

  • php bin/magento indexer:reindex working fine? – Jackson Dec 21 '16 at 1:37
  • @AnkitShah I'm actually getting this error when I try to run that command – DarthVegan Dec 21 '16 at 2:41
  • Please run this Query in DB SET SQL_SAFE_UPDATES = 0; update indexer_state set status = 'invalid' where status != 'valid'; & after that run thi command php bin/magento indexer:reindex customer_grid – Jackson Dec 21 '16 at 2:42
  • @AnkitShah running the php bin/magento indexer:reset does the same thing and I already ran that command and then tried to run the reindex command and I get the same error – DarthVegan Dec 21 '16 at 2:45
  • Have u tried above Queries & Command? – Jackson Dec 21 '16 at 2:48

In order to resolve this issue,you need to create flat table catalog_category_flat_store_1.

disable magento Catalog Flat for Category from Admin>Store>Catalog>Catalog>Use Flat Catalog Category make it NO

enter image description here

Then Flush magento Cache by php bin/magento cache:flush

Then you should drop table catalog_category_flat_store_1, if it is exists in db by drop table catalog_category_flat_store_1

Next enable Catalog Flat for Category by Use Flat Catalog Category make it yes

Final,you need to indexing from magento cli : php bin/magento indexer:reindex

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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