cancel
Showing results for 
Search instead for 
Did you mean: 

Installation of CE 2.2.6 fails with Duplicate entry database error

Installation of CE 2.2.6 fails with Duplicate entry database error

Hi all,

We are installing Magento 2.2.6 in a Docker image via composer. After the installation we run"magento setup:install" which fails with an error from the database complaining about a duplicate key. The exact error message is: 

[...]
[Progress: 308 / 557]
Module 'Magento_CatalogImportExport':
[Progress: 309 / 557]
Module 'Magento_Sales':


[Magento\Framework\DB\Adapter\DuplicateException]                                                                            
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5' for key 'PRIMARY', query was: INSERT INTO `eav_attribute_set` (`entity_type_id`, `attribute_set_name`, `sort_order`, `attribute_set_id`) VALUES (?, ?, ?, ?)


Exception trace:
() at /app/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:580
Magento\Framework\DB\Adapter\Pdo\Mysql->_query() at /app/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:605
Magento\Framework\DB\Adapter\Pdo\Mysql->query() at /app/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:576
Zend_Db_Adapter_Abstract->insert() at /app/vendor/magento/module-eav/Setup/EavSetup.php:341
Magento\Eav\Setup\EavSetup->addAttributeSet() at /app/vendor/magento/module-eav/Setup/EavSetup.php:208
Magento\Eav\Setup\EavSetup->addEntityType() at /app/vendor/magento/module-eav/Setup/EavSetup.php:1396
Magento\Eav\Setup\EavSetup->installEntities() at /app/vendor/magento/module-sales/Setup/InstallData.php:66
Magento\Sales\Setup\InstallData->install() at /app/setup/src/Magento/Setup/Model/Installer.php:874
Magento\Setup\Model\Installer->handleDBSchemaData() at /app/setup/src/Magento/Setup/Model/Installer.php:796
Magento\Setup\Model\Installer->installDataFixtures() at n/a:n/a
call_user_func_array() at /app/setup/src/Magento/Setup/Model/Installer.php:334
Magento\Setup\Model\Installer->install() at /app/setup/src/Magento/Setup/Console/Command/InstallCommand.php:146
Magento\Setup\Console\Command\InstallCommand->execute() at /app/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at /app/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at /app/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at /app/vendor/magento/framework/Console/Cli.php:104
Magento\Framework\Console\Cli->doRun() at /app/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at /app/bin/magento:23
[...]

If you need any more information please let me know. Any help would be much appreciated.

 

Cheers, Shorty

5 REPLIES 5

Re: Installation of CE 2.2.6 fails with Duplicate entry database error

Hello @shorty_butterbl ,

 

There is look like a duplicate entry on your eav_attribute_set table. You can resolve it by removing that entry but you will get the same error in this case. Please try to reinstall Magento 2 and let me you if you still get same issue.

 

 

 

--
If my answer is useful, please Accept as Solution & give Kudos

Re: Installation of CE 2.2.6 fails with Duplicate entry database error

Hi @gelanivishal ,

 

Thanks for helping.

 

Nope. That's a fresh install and the database is empty. As said, I'm starting a Docker container with an empty database. I just verified it. Before the "magento setup:install" command is running the database is completely empty.

Re: Installation of CE 2.2.6 fails with Duplicate entry database error

Hello @shorty_butterbl ,

 

yes, I know that you are getting issue on fresh installation. You can resolve this issue by reinstall the setup.

 

--
If my answer is useful, please Accept as Solution & give Kudos

Re: Installation of CE 2.2.6 fails with Duplicate entry database error

@gelanivishalAhh, I didn't get that the first time. I just tried that. Running setup a second time. And it failed at exactly the same point with the same error. Smiley Sad

Re: Installation of CE 2.2.6 fails with Duplicate entry database error

Hello @shorty_butterbl ,

 

Please make sure you have installed requirements stack 

https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html

 

--
If my answer is useful, please Accept as Solution & give Kudos