while .env file is open
How is this relevant?
Unknown database 'myfirstdb'
Do you have a database named myfirstdb in the configured connection?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Below is the error I get each time I try to use the " php artisan migrate" in vs code terminal while .env file is open. How can I successfully migrate my db?
Illuminate\Database\QueryException
SQLSTATE[HY000] [1049] Unknown database 'myfirstdb' (SQL: select * from information_schema.tables where table_schema = myfirstdb and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712 708▕ // If an exception occurs when attempting to run a query, we'll format the error 709▕ // message to include the bindings with SQL, which will make this exception a 710▕ // lot more helpful to the developer instead of just the database's errors. 711▕ catch (Exception $e) { ➜ 712▕ throw new QueryException( 713▕ $query, $this->prepareBindings($bindings), $e 714▕ ); 715▕ } 716▕ }
+33 vendor frames
34 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
I have fixed the issue by running "CREATE DATABASE myfirstdb;" then ran "php artisan migrate"
Please or to participate in this conversation.