Laravel SQLSTATE[HY000] [1049] Unknown database 'previous_db_name'

It clearly mentions that there's no such database named previous_db_name.

From what it seems the database.php file is not where the variable is from.

Check the .env file in your Laravel installation folder to see if that's the database name that you have wrongly specified.


php artisan cache:clear

AND

restart your server

I had to kill my server and re-run php artisan serve for my project to register the change of my DB_DATABASE name. I kept getting the error even after clearing the cache because I didn't realize this.


If you are using PHP artisan serve just restart it. (just in case someone comes searching as I did).

Tags:

Mysql

Php

Laravel