In this article, We are checking if there is an issue related to database setup with below constraints:
- Magento-2.4.x is alreay setup with composer files hence you have magento2 folder in htdocs of apache server.
- database is already setup.
- Database got corrupted due to any issue and you want to install db again because of some xyz reason.
- You tried to run magento setup command and see below error.
Magento 2.4.4 setup:install problem : "the default website isn't defined. Set the website and try again."
If you will get this issue while setting up database with below command:
php bin/magento setup:install --base-url="http://yourname.magento.com/" --db-host="localhost" --db-name="magento2" --db-user="root" --db-password="root" --admin-firstname="admin" --admin-lastname="admin" --admin-email="user@example.com" --admin-user="admin" --admin-password="Admin@123456" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin" --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200
Drop magento2 database and Go to your magento2 codebase and delete env.php file which has database information.
env.php file location: <Xampp-location>\htdocs\magento2\app\etc
Delete env.php
run magento setup command again.
Hope this helps!
Happy Coding!