Magento – Moving to a New Server, Database Errors & More
I tar.gz my store’s entire directory. I exported the MySQL database. Then I uploaded the tar.gz file to the new server. Extracted it. Created a new MySQL database. Updated app/etc/local.xml with the new MySQL login information. Then I attempted to load the website. The frontend of the website loaded just fine but when I attempted to login to the admin portion of Magento (yourdomain.com/admin). I got a “404 Error. Page not Found.” message. I checked Magento’s system.log (var/log/) to only find these two errors repeating over and over:
ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /home/website/public_html/app/code/core/Mage/Core/Model/App.php on line 624 and defined in /home/website/public_html/app/code/core/Mage/Core/Model/Store.php on line 304
ERR (3): Recoverable Error: Argument 1 passed to Mage_Core_Model_Store_Group::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /home/website/public_html/app/code/core/Mage/Core/Model/App.php on line 644 and defined in /home/website/public_html/app/code/core/Mage/Core/Model/Store/Group.php on line 235
After some research and searching for a solution on the web I came to several posts containing this SQL code to fix the “admin page not loading” problem.
1 [crayon-5c909c478dfcb668378134 inline="true" ]SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET store_id = 0 WHERE code='admin'; UPDATE `core_store_group` SET group_id = 0 WHERE name='Default'; UPDATE `core_website` SET website_id = 0 WHERE code='admin'; UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN'; SET FOREIGN_KEY_CHECKS=1;
While this code appears to have worked for most, it did not work for me. After 12+ hours of troubleshooting this problem I was finally able to narrow down the problem. When I was importing my backed up databases I stripped out the part of the SQL code that creates a “new table”, as I already had one created. In the process of doing so, I stripped out 3 different sets of code that proved to be required for the database to migrate over properly into the MySQL database.
<–MYSQL COD HERE–>
Be sure to clear your cache in your root /tmp/magento directory and in Magento’s tmp directory (/home/website/public_html/var/cache)