Hope your database credentials are correct in a .env
file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE= // Your Database Name
DB_USERNAME= // Your Database Username
DB_PASSWORD= // Your Database Password
If All is correct then After completion of .env
edit, You can clear the configuration cache with the following artisan command: php artisan config:cache
Also, check in config/database.php
, Check that the old database name has not been used on it
Also, If you are using the PHP's default web server (eg. php artisan serve
) you need to restart your server after changing your .env
file values.