7

Appreciate if anyone could help me out, as I've been searching for a solution for hours, but they are all pretty vague.

When I attempt to access my website receive the following error:

There has been an error processing your request SQLSTATE[42S02]: Base table or view not found: 1146 Table 'shopstel_magento.core_store' doesn't exist Trace:
#0 /home/shopstel/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/shopstel/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/shopstel/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT main_ta...', Array)
#3 /home/shopstel/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
#4 /home/shopstel/public_html/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#5 /home/shopstel/public_html/lib/Varien/Data/Collection/Db.php(779): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select), Array)
#6 /home/shopstel/public_html/lib/Varien/Data/Collection/Db.php(696): Varien_Data_Collection_Db->_fetchAll(Object(Varien_Db_Select))
#7 /home/shopstel/public_html/lib/Varien/Data/Collection/Db.php(617): Varien_Data_Collection_Db->getData()
#8 /home/shopstel/public_html/app/code/core/Mage/Core/Model/Mysql4/Store/Collection.php(137): Varien_Data_Collection_Db->load(false, false)
#9 /home/shopstel/public_html/lib/Varien/Data/Collection.php(740): Mage_Core_Model_Mysql4_Store_Collection->load()
#10 /home/shopstel/public_html/app/code/core/Mage/Core/Model/App.php(581): Varien_Data_Collection->count()
#11 /home/shopstel/public_html/app/code/core/Mage/Core/Model/App.php(429): Mage_Core_Model_App->_initStores()
#12 /home/shopstel/public_html/app/code/core/Mage/Core/Model/App.php(335): Mage_Core_Model_App->_initCurrentStore('', 'store')
#13 /home/shopstel/public_html/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#14 /home/shopstel/public_html/index.php(80): Mage::run('', 'store')
#15 {main}

After reading many websites, I understand that Magento is trying to grab a table, that does not exist (for some reason). I have not updated/changed my website for a year or so, and I even asked my host to restore my database to last year, but the error message is still appearing.

I am not an expert at coding, but I can follow specific instructions. Ideally I would like to remove the error without reinstalling Magento. I have read somewhere too that core_store is a simple table. Someone please help me to solve this problem. Let me know if you need any more information from me. Thank you so much and appreciate your time!

2
  • Can you determine the name of the tables in that database that end in store?
    – user4351
    Commented Mar 2, 2015 at 19:50
  • Sorry how do I go about doing this? I did use the find function for 'core_store' and it gave 0 result.
    – shopstelle
    Commented Mar 5, 2015 at 17:04

4 Answers 4

4

The table you are looking for is a simple table.

When your host restored your database, it sounds like it did not have the core_store table inside of it. Also, it might be that there is a table prefix that might or might not be at play here.

Try these first:

  1. Check your database to ensure there is a core_store (or variant) table available.
  2. Check to make sure your local.xml config file is pointing to the right database.
  3. Ask your host to restore from another restore point.
  4. Check to ensure your local.xml didn't have a table prefix recently added or removed.

If that does not work, you can always do raw SQL inside your database.

PLEASE NOTE: TEST THIS ON A NON PRODUCTION ENVIRONMENT BEFORE PRODUCTION!

Core Store Table:

CREATE TABLE `core_store` (
  `store_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Store Id',
  `code` varchar(32) DEFAULT NULL COMMENT 'Code',
  `website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website Id',
  `group_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Group Id',
  `name` varchar(255) NOT NULL COMMENT 'Store Name',
  `sort_order` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store Sort Order',
  `is_active` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Store Activity',
  PRIMARY KEY (`store_id`),
  UNIQUE KEY `UNQ_core_store_CODE` (`code`),
  KEY `IDX_core_store_WEBSITE_ID` (`website_id`),
  KEY `IDX_core_store_IS_ACTIVE_SORT_ORDER` (`is_active`,`sort_order`),
  KEY `IDX_core_store_GROUP_ID` (`group_id`),
  CONSTRAINT `FK_core_store_GROUP_ID_core_store_GROUP_GROUP_ID` FOREIGN KEY (`group_id`) REFERENCES `core_store_group` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_core_store_WEBSITE_ID_WBCORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `wbcore_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Stores';

Insert default entries:

INSERT INTO `core_store` VALUES (0,'admin',0,0,'Admin',0,1),(1,'default',1,1,'Default Store View',0,1);
2
  • I did use the find function for 'core_store' and it gave 0 result, or is there a specific folder I am supposed to look at so I can identify this quicker? My host have restored it from an earlier database too (2 months earlier), and the website is basically 'empty' with that database. The local.xml file has been untouched for few years. I will try your raw SQL suggestion with my host and get back to you. Thanks for your help!
    – shopstelle
    Commented Mar 5, 2015 at 17:08
  • cant add foreign key constraint error when trying to create
    – jtlindsey
    Commented Jan 28, 2018 at 5:09
2

Something changed. The trick is not to make matters worse by recreating things. Start by checking the folder var/cache below the document root (this is the folder that has index.php and the app folder. If var/cache exists and has subfolders like mage---*, rename var/cache to var/cache.old. Test if this fixes the issue.

If it doesn't, please specify what tools you have available to interact with the database. For example, does your hoster provide the phpMyadmin tool?

What we know from your report That it is very unlikely that the table is missing, unless you have not visited your site in two months or it has been running on an external cache and no one has tried to place an order.

That the table definition can be found or is cached in the DDL cache. When Magento queries a database table, it stores the definition of the table in the DDL cache, meaning Data Definition Language.

That your connection to the database works, or you would have a message about permission to the database being denied, invalid adapter or invalid username / password combination.

Possible causes

  • Cache corruption
  • Corruption of the "ibdata" file, causing MySQL not being able to find the data, while the definition in the ".frm" file is in tact.
    • Local.xml has changed and it's prefix removed, but the timestamp of the file does not reflect it.
1

I can say, that if you have backup of database restore that database please as table core_store table is missing. I am 100% sure issue will get solved.

0

Clearing the var/cache folder instantly solved this issue for me. :)

0

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.