Hey everyone i am new to magento and while setting it up i encountered this error . Now tried searching for different solution but none of them worked . The other questions related to this error were started on the 4th position but in my case it started in the second position so i couldn't find something to debug this and solve it. I have used lando for magento installation. so can someone help in here . Thanks enter image description here

  • Remove generated folder. sudo rm -rf generated;
    – S.P
    May 11, 2022 at 7:00
  • tried removing generated folder not working May 11, 2022 at 8:52
  • rename your etc/env.php file and run php bin/magento setup:install --base-url= \ --db-host=localhost --db-name=magento --db-user=magento --db-password=magento \ --admin-firstname=Magento --admin-lastname=User [email protected] \ --admin-user=admin --admin-password=admin123 --language=en_US \ --currency=USD --timezone=America/Chicago --use-rewrites=1 command replace your databasename,username and password keep it same as you had installed.
    – S.P
    May 11, 2022 at 9:31
  • did you get a solution
    – Mohit Rane
    Feb 27, 2023 at 20:56

2 Answers 2


=>>> DELETE env.php file.

After run this command

php bin/magento setup:install --base-url="http://localhost/magento4" --db-host="localhost" --db-name="magento4" --db-user="root" --db-password= --admin-user="admin" --admin-password="admin@123" --admin-firstname="admin12" --admin-lastname="user" --admin-email="[email protected]" --backend-frontname="admin"

  • tried removing env.php not worked , same error occurs because the site is getting this error before checking the database at step 2 , the database will be checked at 4th step May 11, 2022 at 8:53

What you can try to do:

  1. Clean env.php file if exist in app/etc folder.

  2. Remove generated folder manually or with command sudo rm -rf generated

  3. Clean database manually or by using --cleanup-database option in setup command.

In case, if it not helped, you can try to use another DB name or try to use composer 1.9 version. Also recommend to use installation command with options:

magento setup:install --base-url= --db-host=localhost --db-name=magento --db-user=magento --db-password=magento --admin-firstname=Magento --admin-lastname=User [email protected] --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=es-host.example.com --elasticsearch-port=9200 --cleanup-database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.