How To Fix Laravel SQLite "Database does not exist" error?

In laravel on 1~2 minutes Post a comment

First, check whether that you made necessary environment variable changes in .env file as described in the How To Use SQLite Database In Laravel. If you have already tried it but not working, comment all the database related lines in the .env file like this.


This will completely prevent loading the database configuration from the .env file. Then open the database.php file in the config directory to mention the configuration directly.

But before continuing, it should not be encouraged to hard-code environment variables directly into the code. But in this scenario, the SQLite connection does not require any username or password as MySQL does.

So, change the default database connection to SQLite.

'default' => env('DB_CONNECTION', 'sqlite'),

In the connections array, only change the database line as following and leave other lines as they are,

'sqlite' => [
    'database' => database_path('database.sqlite'),

After that, try to run the migration:status command.

php artisan migrate:status
You May Also Like: