Magento 2 Error – Base Table or View Not Found

databasemagento2

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

Best Answer

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>Stores>Configuration>Catalog>Catalog>StoreFront>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

Related Topic