Magento: error message – Notice: Undefined index: 0 app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92
The Quick resolution to this problem it to move the database command line, and not use phpmyadmin. If you just need to fix your database keep reading.
I was moving a installation to a production server and was getting this error message: Notice: Undefined index: 0 in app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92. It took alot of searching to figure out the problem, but here is what I found. When Magento installs it sets store and website ids in the database. When transferring the database the new database did not like having an id of 0 for the admin part of the site, so it made it have an id of 2. This is what my problem was. To fix it I went into the core_store and core_website Tables and gave the admin site an id of 0. It looks like this may only affect certain versions of magento(Earlier versions). Hope this helps someone else.
P.S. I also got foreign_key_constraint errors when importing my database. To solve this disable foreign key check when you export your database. Then when you need to change the core_store and core_website id’s you will probably need to surround your sql with the following code:
set foreign_key_checks=0;
//SQL to update ids
SET FOREIGN_KEY_CHECKS=1;

35 Responses to “ Magento: error message – Notice: Undefined index: 0 app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92 ”
March 23rd, 2009 at 11:28 pm
Thank you for sharing this information!
March 31st, 2009 at 10:20 am
Thanks!. Lifesaver for me
May 4th, 2009 at 4:52 am
Thanks!!!
May 6th, 2009 at 4:16 am
Thanks Mate, it saved many hours for me.
May 15th, 2009 at 1:15 am
Hello,
if you migrate your Magento Online store to another server, you have to input in your sql dump the following line:
SET SQL_MODE = NO_AUTO_VALUE_ON_ZERO;
So this error never happens
June 29th, 2009 at 1:59 am
Thanks! You saved me!!
July 16th, 2009 at 7:49 am
hey Mike, u r a life saver for me too. was stuck at this error for quite some time now. after changing the IDs, everything worked like a breeze
thanks once again!
July 30th, 2009 at 2:42 pm
I could kiss you.
Thanks a million.
September 9th, 2009 at 2:00 pm
You are a God, dude.
September 18th, 2009 at 9:46 am
They need to stop wasting our time, a few minutes an extra day of common sense would save collective thousands of hours of developer time. Its not like we asked them to not release a test suite or documentation.
October 28th, 2009 at 9:09 am
Thank you ! Quick search, quick answer, quick fix !
November 11th, 2009 at 8:32 am
You are the man – thanks a lot for this information.
December 18th, 2009 at 11:59 pm
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 38: parser error : Entity ‘trade’ not defined in /www/magento/lib/Varien/Simplexml/Config.php on line 510
Trace:
#0 /www/magento/lib/Varien/Simplexml/Config.php(510): mageCoreErrorHandler(2, ‘simplexml_load_…’, ‘/content/Hostin…’, 510, Array)
#1 /www/magento/lib/Varien/Simplexml/Config.php(498): Varien_Simplexml_Config->loadString(’loadFile(’loadModulesConfiguration(’/content/Hostin…’)
#4 /www/magento/app/code/core/Mage/Adminhtml/Model/Config.php(63): Mage_Adminhtml_Model_Config->_initSectionsAndTabs(’system.xml’)
#5 /www/magento/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php(70): Mage_Adminhtml_Model_Config->getSections()
#6 /www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(376): Mage_Adminhtml_System_ConfigController->editAction(NULL)
#7 /www/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch()
#8 /www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(’edit’)
#9 /www/magento/app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#10 /www/magento/index.php(65): Mage::run()
#11 {main}
Will really really appreciate if someone can help me with getting this going. I am at the last lap of the entire project and this has put a spanner in the works. Friends please help urgently.
December 19th, 2009 at 9:52 am
Do you have any custom modules installed? Did this begin after installing something? check any config.xml and system.xml files you have modified or created.
December 22nd, 2009 at 2:30 am
Thanks a lot life saver for me
January 14th, 2010 at 10:45 pm
Hey thanks a lot.. very useful.. God will surely bless u..
February 4th, 2010 at 10:05 am
I changed the admin site to 0 in both tables but it does not work in my case. could somone help?
February 4th, 2010 at 1:03 pm
@monsbutu: are you getting this exact error message? if not you might want to post the error you are getting. Also when did this error start occurring?
February 4th, 2010 at 8:12 pm
Thank you dude, saved my life
February 10th, 2010 at 3:06 pm
Helps a lot. TY !
February 12th, 2010 at 1:46 am
Hi,
I have another solution.
First: Import only structure of tables.
Next, import data but add at the very top of your SQL script:
SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
It works
March 3rd, 2010 at 3:30 am
Thanks a million. Saved my life.
March 4th, 2010 at 5:05 pm
I want to donate some money to you for this post! It was a lifesaver. BTW This post has been pirated by quite a few spammy magento sites.
March 11th, 2010 at 1:54 pm
it works!
March 24th, 2010 at 6:48 am
dankeschön!
greetings from dresden
April 12th, 2010 at 12:07 am
thank you for sharing that information! i was starting to bite my keyboard!
greetings from flensburg.
April 18th, 2010 at 3:55 am
Thanks a lot, saved me a bunch of time!
April 27th, 2010 at 2:52 pm
ur the man!!!
April 30th, 2010 at 4:48 am
Thanks!!
May 11th, 2010 at 2:22 am
great job … thanks
May 28th, 2010 at 3:45 pm
You, sir, are my new hero. Thank you!
June 20th, 2010 at 2:01 am
Wow, huge time saver … sending karma your way!
July 7th, 2010 at 5:27 am
u r my life saver dear, I Love U
July 9th, 2010 at 10:15 am
Had the problem with Magento 1.4 – found this site and the problem was solved!
Thak you very much!
July 27th, 2010 at 3:17 am
Man, you are the legend.. thanks for this stuff.. works!