Skip to content

Magento 2.0.x and 2.1.x does not respect table prefix during installation #5688

Closed
@stamster

Description

@stamster

Steps to reproduce

  1. Install Magento from official 2.1.0.tar.gz archive here on GitHub.
  2. Fill out DB settings as ususal, alongside with table prefix (i.e. 'my_')
  3. Begin installation procedure

Expected result

Installation finished w/o any errors.

Actual result

Installation is incomplete.
Check the console log for errors before trying again

Magento fails with [ERROR] exception 'PDOException'!

So Magento fails here big time with NOT respecting table prefix entered during installation, instead it CHECKS for actual data from old installation with DIFFERENT table prefix?! It even checks entire database for each table like admin_user table which does not have any prefix and complains that email is already taken etc if you really don't have any table prefix.

TABLES CREATED DURING INSTALLATION: van_cache, van_cache_tag, van_flag, van_session, van_setup_module, van_store_website and after this it just fails.

How in the world this is possible, or is it a new requirement for M2 to have empty database, i.e. table prefixes are not supported any more?

This is issue is present from v.2.0.4+ as I experienced it multiple times.

Here's a full stack trace.

Installation is incomplete.
Check the console log for errors before trying again. 



Starting Magento installation:
File permissions check...

Required extensions check...

Enabling Maintenance Mode...

Installing deployment configuration...

Installing database schema:
Schema creation/updates:
Module 'Magento_Store':
Installing schema...
[ERROR] exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table `mage21`.`van_store_group` (errno: 121 "Duplicate key on write or update")' in /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array)
#2 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
#3 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('CREATE TABLE IF...', Array)
#5 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(452): Zend_Db_Adapter_Pdo_Abstract->query('CREATE TABLE IF...', Array)
#6 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(507): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('CREATE TABLE IF...', Array)
#7 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(1993): Magento\Framework\DB\Adapter\Pdo\Mysql->query('CREATE TABLE IF...')
#8 /var/www/html/m21vanilla/app/code/Magento/Store/Setup/InstallSchema.php(159): Magento\Framework\DB\Adapter\Pdo\Mysql->createTable(Object(Magento\Framework\DB\Ddl\Table))
#9 /var/www/html/m21vanilla/setup/src/Magento/Setup/Model/Installer.php(843): Magento\Store\Setup\InstallSchema->install(Object(Magento\Setup\Module\Setup), Object(Magento\Setup\Model\ModuleContext))
#10 /var/www/html/m21vanilla/setup/src/Magento/Setup/Model/Installer.php(779): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\Setup), 'schema')
#11 [internal function]: Magento\Setup\Model\Installer->installSchema()
#12 /var/www/html/m21vanilla/setup/src/Magento/Setup/Model/Installer.php(344): call_user_func_array(Array, Array)
#13 /var/www/html/m21vanilla/setup/src/Magento/Setup/Controller/Install.php(109): Magento\Setup\Model\Installer->install(Array)
#14 /var/www/html/m21vanilla/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 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#17 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 /var/www/html/m21vanilla/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#19 /var/www/html/m21vanilla/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 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#22 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#23 /var/www/html/m21vanilla/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#24 /var/www/html/m21vanilla/setup/index.php(31): Zend\Mvc\Application->run()
#25 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table `mage21`.`van_store_group` (errno: 121 "Duplicate key on write or update"), query was: CREATE TABLE IF NOT EXISTS `van_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 `van_store_website` (`website_id`) ON DELETE CASCADE
) COMMENT='Store Groups' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci' in /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Statement/Pdo/Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
#2 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/html/m21vanilla/vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('CREATE TABLE IF...', Array)
#4 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(452): Zend_Db_Adapter_Pdo_Abstract->query('CREATE TABLE IF...', Array)
#5 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(507): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('CREATE TABLE IF...', Array)
#6 /var/www/html/m21vanilla/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php(1993): Magento\Framework\DB\Adapter\Pdo\Mysql->query('CREATE TABLE IF...')
#7 /var/www/html/m21vanilla/app/code/Magento/Store/Setup/InstallSchema.php(159): Magento\Framework\DB\Adapter\Pdo\Mysql->createTable(Object(Magento\Framework\DB\Ddl\Table))
#8 /var/www/html/m21vanilla/setup/src/Magento/Setup/Model/Installer.php(843): Magento\Store\Setup\InstallSchema->install(Object(Magento\Setup\Module\Setup), Object(Magento\Setup\Model\ModuleContext))
#9 /var/www/html/m21vanilla/setup/src/Magento/Setup/Model/Installer.php(779): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\Setup), 'schema')
#10 [internal function]: Magento\Setup\Model\Installer->installSchema()
#11 /var/www/html/m21vanilla/setup/src/Magento/Setup/Model/Installer.php(344): call_user_func_array(Array, Array)
#12 /var/www/html/m21vanilla/setup/src/Magento/Setup/Controller/Install.php(109): Magento\Setup\Model\Installer->install(Array)
#13 /var/www/html/m21vanilla/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 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#16 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 /var/www/html/m21vanilla/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 /var/www/html/m21vanilla/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 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#21 /var/www/html/m21vanilla/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#22 /var/www/html/m21vanilla/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#23 /var/www/html/m21vanilla/setup/index.php(31): Zend\Mvc\Application->run()
#24 {main}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions