cancel
Showing results for 
Search instead for 
Did you mean: 

Installation error in 1.9.3.3 CE

Installation error in 1.9.3.3 CE

Trying to install Magento 1.9.3.3 CE on Azure Web App, and MySQL on Azure. But having error indicating table already exist. Tried to drop the table but MySQL shows "Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint fails"

 

Below is the error shows during installation. Thanks for helping.

There has been an error processing your request
Error in file: "D:\home\site\wwwroot\app\code\core\Mage\Catalog\sql\catalog_setup\install-1.6.0.0.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'catalog_product_entity' already exists, query was: CREATE TABLE `catalog_product_entity` (
  `entity_id` int UNSIGNED NOT NULL auto_increment COMMENT 'Entity ID' ,
  `entity_type_id` smallint UNSIGNED NOT NULL default '0' COMMENT 'Entity Type ID' ,
  `attribute_set_id` smallint UNSIGNED NOT NULL default '0' COMMENT 'Attribute Set ID' ,
  `type_id` varchar(32) NOT NULL default 'simple' COMMENT 'Type ID' ,
  `sku` varchar(64) NULL COMMENT 'SKU' ,
  `has_options` smallint NOT NULL default '0' COMMENT 'Has Options' ,
  `required_options` smallint UNSIGNED NOT NULL default '0' COMMENT 'Required Options' ,
  `created_at` timestamp NULL default NULL COMMENT 'Creation Time' ,
  `updated_at` timestamp NULL default NULL COMMENT 'Update Time' ,
  PRIMARY KEY (`entity_id`),
  INDEX `IDX_CATALOG_PRODUCT_ENTITY_ENTITY_TYPE_ID` (`entity_type_id`),
  INDEX `IDX_CATALOG_PRODUCT_ENTITY_ATTRIBUTE_SET_ID` (`attribute_set_id`),
  INDEX `IDX_CATALOG_PRODUCT_ENTITY_SKU` (`sku`),
  CONSTRAINT `FK_CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY (`attribute_set_id`) REFERENCES `eav_attribute_set` (`attribute_set_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID` FOREIGN KEY (`entity_type_id`) REFERENCES `eav_entity_type` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
) COMMENT='Catalog Product Table' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci
Trace: #0 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\Resource\Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...') #1 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\Resource\Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb('install', '', '1.6.0.0.19.1.5') #2 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\Resource\Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb('1.6.0.0.19.1.5') #3 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\Resource\Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates() #4 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates() #5 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Model_App->_initModules() #6 D:\home\site\wwwroot\app\Mage.php(684): Mage_Core_Model_App->run(Array) #7 D:\home\site\wwwroot\index.php(83): Mage::run('', 'store') #8 {main}
4 REPLIES 4

Re: Installation error in 1.9.3.3 CE

can I know if Magento is compatible with Azure Database for MySQL server – Preview?

I got many sql error when configure Magento during setup

for example, need disable foreign key check when drop table

SET FOREIGN_KEY_CHECKS=0;

 

then got below error

Error in file: "D:\home\site\wwwroot\app\code\core\Mage\CatalogSearch\sql\catalogsearch_setup\install-1.6.0.0.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'catalogsearch_query' already exists, query was: CREATE TABLE `catalogsearch_query` (

  `query_id` int UNSIGNED NOT NULL auto_increment COMMENT 'Query ID' ,

 

Based on error message, I add below code in install-1.6.0.0.php to check if Table 'catalogsearch_query' already exists, if already existing, it won’t create again:

 

$tableName = $installer->getTable('catalogsearch/search_query');

// Check if the table already exists

if ($installer->getConnection()->isTableExists($tableName) != true) {

    $table = $installer->getConnection()

    ->newTable($installer->getTable('catalogsearch/search_query'))

->addColumn('query_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(

 

next got anther table error

Error in file: "D:\home\site\wwwroot\app\code\core\Mage\Catalog\sql\catalog_setup\upgrade-1.6.0.0.9-1.6.0.0.10.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'catalog_product_entity_group_price' already exists, query was: CREATE TABLE `catalog_product_entity_group_price` (

  `value_id` int NOT NULL auto_increment COMMENT 'Value ID' ,

 

I doubt if Magento  is compatible with Azure Database for MySQL server – Preview?

 

, I did another test for the latest version Magento-CE-2.1.8 with Azure Database for MySQL server – Preview and get error below: seems still relate to Mysql.

Module 'Magento_Directory':
Installing data... 
[ERROR] exception 'Exception' with message 'Warning: Error while sending QUERY packet. PID=8896 in D:\home\site\wwwroot\vendor\magento\zendframework1\library\Zend\Db\Statement\Pdo.php on line 228' in D:\home\site\wwwroot\vendor\magento\framework\App\ErrorHandler.php:61

Stack trace:

#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'Error while sen...', 'D:\\home\\site\\ww...', 228, Array)

#1 D:\home\site\wwwroot\vendor\magento\zendframework1\library\Zend\Db\Statement\Pdo.php(228): PDOStatement->execute(Array)

#2 D:\home\site\wwwroot\vendor\magento\framework\DB\Statement\Pdo\Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array)

#3 D:\home\site\wwwroot\vendor\magento\zendframework1\library\Zend\Db\Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)

#4 D:\home\site\wwwroot\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(480): Zend_Db_Statement->execute(Array)

#5 D:\home\site\wwwroot\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('UPDATE `setup_m...', Array)

#6 D:\home\site\wwwroot\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(465): Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `setup_m...', Array)

#7 D:\home\site\wwwroot\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(520): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('UPDATE `setup_m...', Array)

#8 D:\home\site\wwwroot\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(635): Magento\Framework\DB\Adapter\Pdo\Mysql->query('UPDATE `setup_m...', Array)

#9 D:\home\site\wwwroot\vendor\magento\framework\Module\ModuleResource.php(129): Zend_Db_Adapter_Abstract->update('setup_module', Array, Array)

#10 D:\home\site\wwwroot\setup\src\Magento\Setup\Model\Installer.php(854): Magento\Framework\Module\ModuleResource->setDataVersion('Magento_Directo...', '2.0.0')

#11 D:\home\site\wwwroot\setup\src\Magento\Setup\Model\Installer.php(796): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data')

#12 [internal function]: Magento\Setup\Model\Installer->installDataFixtures()

#13 D:\home\site\wwwroot\setup\src\Magento\Setup\Model\Installer.php(344): call_user_func_array(Array, Array)

#14 D:\home\site\wwwroot\setup\src\Magento\Setup\Controller\Install.php(109): Magento\Setup\Model\Installer->install(Array)

#15 D:\home\site\wwwroot\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(82): Magento\Setup\Controller\Install->startAction()

#16 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))

#17 D:\home\site\wwwroot\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))

#18 D:\home\site\wwwroot\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))

#19 D:\home\site\wwwroot\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))

#20 D:\home\site\wwwroot\vendor\zendframework\zend-mvc\src\DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))

#21 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))

#22 D:\home\site\wwwroot\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))

#23 D:\home\site\wwwroot\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))

#24 D:\home\site\wwwroot\vendor\zendframework\zend-mvc\src\Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))

#25 D:\home\site\wwwroot\setup\index.php(31): Zend\Mvc\Application->run()

#26 {main}

Please suggest, thanks,

Anik

Re: Installation error in 1.9.3.3 CE

Does it support Azure MySQL server – Preview: v5.6 ?

Re: Installation error in 1.9.3.3 CE

Hello there,

I am not 100% sure in your case, but If you're trying to update or drop a table in MySQL and you're getting the error 'Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint fails' you need to toggle the foreign_key_checks variable first.

The reason for this error is because your tables have foreign keys which rely on the table you're attempting to change. Here's the fix for MySQL error Code 1217 – A foreign key constraint fails:

SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE `stats`;
SET FOREIGN_KEY_CHECKS = 1;

I hope this will help. I would recommend, go through Managed Azure Services to get more information and better understanding about it.

Regards.

Re: Installation error in 1.9.3.3 CE

Hello,

The error you're encountering during the Magento 1.9.3.3 CE installation is due to a table ('catalog_product_entity') already existing in the MySQL database. Attempting to drop it directly may result in a foreign key constraint failure. You may need to manage the database Zero Drop schema carefully, ensuring proper handling of existing tables and foreign key dependencies. Reviewing and managing database operations within the setup files can help resolve this issue.