magento2: Running setup:install with --cleanup-database flag is no longer possible when your app/etc/env.php exists

This was accidentally discovered while trying to replicate another bug.

So, I was trying to install the current version of the 2.2-develop branch with the bin/magento setup:install command, and it fails. After bisecting, I found the commit which introduced the problem and that is: 914389161fee5091bfe6ea3069755295c7243ecf Since that commit dates from March 2018, I feel like someone should at least have noticed this, yet, we are 3 months down the line and it still happens, so this has worried me little bit …

/cc @slopukhov

Preconditions

  1. PHP 7.0.30

Steps to reproduce

  1. Clone this repo and checkout the 2.2-develop branch, I’m using commit 10f84fdd222f085fcb007631976b113775b02143
  2. Run composer install
  3. Run ./bin/magento setup:install --admin-firstname=Ad --admin-lastname=Min --admin-email=someone@example.com --admin-user=admin --admin-password=admin123 --base-url=https://example.com/ --base-url-secure=https://example.com/ --backend-frontname=admin --db-host=localhost --db-name=magento2-github --db-user=root --db-password=*secret* --language=en_US --currency=EUR --timezone=Europe/Brussels --use-rewrites=1 --use-secure=1 --use-secure-admin=1 --admin-use-security-key=1 --session-save=files --cleanup-database

Expected result

Installation goes fine without errors

Actual result

Starting Magento installation:
File permissions check...
[Progress: 1 / 486]
Required extensions check...
[Progress: 2 / 486]
Enabling Maintenance Mode...
[Progress: 3 / 486]
Installing deployment configuration...
[Progress: 4 / 486]
Cleaning up database...
Cleaning up database `magento2-github`
[Progress: 5 / 486]
Installing database schema:


  [Zend_Db_Statement_Exception]
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2-github.store_website' doesn't exist, query was: SELECT `store_website`.* FROM `store_website`



  [PDOException]
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2-github.store_website' doesn't exist

Additional information

  1. (added 11 Jan 2019) Additional steps to reproduce were provided in the comments below, please see more details by this link https://github.com/magento/magento2/issues/15864#issuecomment-441100421

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 19 (13 by maintainers)

Most upvoted comments

Hi, @hostep Yes, looks like this is bug (with DB connection in the install script with ‘–cleanup-database’ option with existing /app/etc/env.php) and removing /app/etc/env.php file just idea to quick fix.

Hi, @hostep Looks like problem in the ‘–cleanup-database’ with existing /app/etc/env.php file. Please try to delete this file before reinstall.