Error While Installing Magento 2.0.1: Integrity constraint violation: 1022 Can't write; duplicate key in table 'store_group''

I have an error on last step while installing Magento 2.0.1

Starting Magento installation:
File permissions check…

Enabling Maintenance Mode…

Installing deployment configuration…

Installing database schema:
Schema creation/updates:
Module ‘Magento_Store’:
Installing schema…
[ERROR]
exception ‘PDOException’ with message ‘SQLSTATE[23000]: Integrity
constraint violation: 1022 Can’t write; duplicate key in table
’store_group’’ in
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0

/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php(228):
PDOStatement->execute(Array)
#1
/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(95):
Zend_Db_Statement_Pdo->_execute(Array)
#2
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Statement.php(303):
Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
#3
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480):
Zend_Db_Statement->execute(Array)
#4
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238):
Zend_Db_Adapter_Abstract->query(‘CREATE TABLE IF…’, Array)
#5
/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(444):
Zend_Db_Adapter_Pdo_Abstract->query(‘CREATE TABLE IF…’, Array)
#6

/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(499):
Magento\Framework\DB\Adapter\Pdo\Mysql->_query(‘CREATE TABLE IF…’,
Array)
#7
/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(1984):
Magento\Framework\DB\Adapter\Pdo\Mysql->query(‘CREATE TABLE IF…’)
#8

/opt/lampp/htdocs/gauntletGallery/vendor/magento/module-store/Setup/InstallSchema.php(140):

Magento\Framework\DB\Adapter\Pdo\Mysql->createTable(Object(Magento\Framework\DB\Ddl\Table))
#9

/opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Model/Installer.php(798):

Magento\Store\Setup\InstallSchema->install(Object(Magento\Setup\Module\Setup),
Object(Magento\Setup\Model\ModuleContext))
#10
/opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Model/Installer.php(732):

Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\Setup),
‘schema’)
#11 [internal function]: Magento\Setup\Model\Installer->installSchema()
#12 /opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Model/Installer.php(331): call_user_func_array(Array, Array)
#13

/opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Controller/Install.php(97):
Magento\Setup\Model\Installer->install(Array)
#14
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82):
Magento\Setup\Controller\Install->startAction()
#15 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#16

/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(444):
call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#17
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(205):
Zend\EventManager\EventManager->triggerListeners(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#18
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118):
Zend\EventManager\EventManager->trigger(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#19
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/DispatchListener.php(93):

Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request),
Object(Zend\Http\PhpEnvironment\Response))
#20 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#21

/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(444):
call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#22
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(205):
Zend\EventManager\EventManager->triggerListeners(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#23
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/Application.php(314):
Zend\EventManager\EventManager->trigger(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#24 /opt/lampp/htdocs/gauntletGallery/setup/index.php(31): Zend\Mvc\Application->run()
#25 {main}

Next
exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[23000]:
Integrity constraint violation: 1022 Can’t write; duplicate key in table
’store_group’, query was: CREATE TABLE IF NOT EXISTS store_group (
group_id smallint UNSIGNED NOT NULL auto_increment COMMENT ‘Group Id’ ,
website_id smallint UNSIGNED NOT NULL default ‘0’ COMMENT ‘Website Id’ ,
name varchar(255) NOT NULL COMMENT ‘Store Group Name’ ,
root_category_id int UNSIGNED NOT NULL default ‘0’ COMMENT ‘Root Category Id’ ,
default_store_id smallint UNSIGNED NOT NULL default ‘0’ COMMENT ‘Default Store Id’ ,
PRIMARY KEY (group_id),
INDEX STORE_GROUP_WEBSITE_ID (website_id),
INDEX STORE_GROUP_DEFAULT_STORE_ID (default_store_id),

CONSTRAINT STORE_GROUP_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID FOREIGN
KEY (website_id) REFERENCES store_website (website_id) ON DELETE
CASCADE
) COMMENT=‘Store Groups’ ENGINE=INNODB charset=utf8
COLLATE=utf8_general_ci’ in
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0

/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(95):
Zend_Db_Statement_Pdo->_execute(Array)
#1
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Statement.php(303):
Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
#2
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480):
Zend_Db_Statement->execute(Array)
#3
/opt/lampp/htdocs/gauntletGallery/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238):
Zend_Db_Adapter_Abstract->query(‘CREATE TABLE IF…’, Array)
#4
/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(444):
Zend_Db_Adapter_Pdo_Abstract->query(‘CREATE TABLE IF…’, Array)
#5

/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(499):
Magento\Framework\DB\Adapter\Pdo\Mysql->_query(‘CREATE TABLE IF…’,
Array)
#6
/opt/lampp/htdocs/gauntletGallery/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(1984):
Magento\Framework\DB\Adapter\Pdo\Mysql->query(‘CREATE TABLE IF…’)
#7

/opt/lampp/htdocs/gauntletGallery/vendor/magento/module-store/Setup/InstallSchema.php(140):

Magento\Framework\DB\Adapter\Pdo\Mysql->createTable(Object(Magento\Framework\DB\Ddl\Table))
#8

/opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Model/Installer.php(798):

Magento\Store\Setup\InstallSchema->install(Object(Magento\Setup\Module\Setup),
Object(Magento\Setup\Model\ModuleContext))
#9
/opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Model/Installer.php(732):

Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\Setup),
‘schema’)
#10 [internal function]: Magento\Setup\Model\Installer->installSchema()
#11 /opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Model/Installer.php(331): call_user_func_array(Array, Array)
#12

/opt/lampp/htdocs/gauntletGallery/setup/src/Magento/Setup/Controller/Install.php(97):
Magento\Setup\Model\Installer->install(Array)
#13
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82):
Magento\Setup\Controller\Install->startAction()
#14 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#15

/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(444):
call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#16
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(205):
Zend\EventManager\EventManager->triggerListeners(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#17
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118):
Zend\EventManager\EventManager->trigger(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#18
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/DispatchListener.php(93):

Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request),
Object(Zend\Http\PhpEnvironment\Response))
#19 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#20

/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(444):
call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#21
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-eventmanager/src/EventManager.php(205):
Zend\EventManager\EventManager->triggerListeners(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#22
/opt/lampp/htdocs/gauntletGallery/vendor/zendframework/zend-mvc/src/Application.php(314):
Zend\EventManager\EventManager->trigger(‘dispatch’,
Object(Zend\Mvc\MvcEvent), Object(Closure))
#23 /opt/lampp/htdocs/gauntletGallery/setup/index.php(31): Zend\Mvc\Application->run()
#24 {main}

When you install (not upgrade) Magento 2, you shoud use an empty database.
Please re-run the installation with an empty database.

Also, Magento 2 team has reported there is a problem with upgrading (not installing) to Magento 2.0.1 using a ZIP distrubutive: https://community.magento.com/t5/Version-Upgrades-for-2-x/Update-on-failed-2-0-x-upgrades-with-zip-archives/m-p/27096

I have just upgraded to the latest development version using GitHub without any problem.

1 Like