Found solution for Magento – “SQLSTATE[HY000]: General error” on installation


I wrote already in the past about eCommerce System. I play with Magento till now from time to time. Unfortunately I had some problems with the installation and I could not find  help in the web. Therefore maybe this post  can be useful for some of you how is dealing whis Magento too.

The Problem

Every time on  the installation of Magento i saw following  exception.

Error in file: ".... app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php" - SQLSTATE[HY000]: General error: 1005 Can't create table './db203484_1/#sql-1dd4_17baf.frm' (errno: 121)
#0 .../app/code/core/Mage/Core/Model/Resource/Setup.php(286): Mage::exception('Mage_Core', 'Error in file: ...')
#1 Mage_Core_Model_Resource_Setup->_modifyResourceDb('install', '', '0.8.11')
#2 .../app/code/core/Mage/Core/Model/Resource/Setup.php(154): Mage_Core_Model_Resource_Setup->_installResourceDb('0.8.11')
#3 .../app/code/core/Mage/Core/Model/Resource/Setup.php(120): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 .../app/code/core/Mage/Core/Model/Config.php(215): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 .../app/code/core/Mage/Core/Model/App.php(236): Mage_Core_Model_Config->init(Array)
#6 .../app/Mage.php(424): Mage_Core_Model_App->init('', 'store', Array)
#7 .../app/Mage.php(443): Mage::app('', 'store', Array)
#8 .../index.php(52): Mage::run()
#9 {main}

I tried installation with version 1.1.3, 1.1.4, 1.1.6 and 1.1.8 nothing helped…

You can find many threads on Magentocommere Forum to this issue. Some hints may help you once but do not solve the problem. I guess I don’t have solved problem globally. But I found the cause of the problem so everybody can solve it on his own way.

Cause of the exception

During the installation routine  many DB-Tables should be created in your Database. We talk here about MySQL Database.  So Magento begins with SQL-Statement that are holded in the mysql4-install-0.8.0.php.This file is also pintet in the Exception message as the causes of the problem.

I analysed the Statement and this came out..

Before any CREATE-Statement – Magento executes this:


Then, after all tables and indexes  defined in  mysql4-install-0.8.0.php are created, magento executes following Statement.:


An the last row causes #1231 – Variable ‘foreign_key_checks’ can’t be set to the value of ‘0’ Exception which is finely identified by me as  the cause of such installation problems!


I did’n spend much time to find out why the Varibale SET FOREIGN_KEY_CHECKS can’t be set to ’0′, because it looks like MySQL bug.

However, it’s maybe not the finest solution but it helps. If you can drop the whole the database and create new one, then the installation works. It seems to set all the before settings back and installtion works fine on “vergin-Databases”.

Leave a Reply

You must be logged in to post a comment.