SarahS's avatar
Level 12

Setting up SQLite

I'm having problems accessing my local MySQL so I'm going to try and use SQLite instead. Following the official docs I have so far just run this in my project:

touch database/database.sqlite

Now it says I have to add:

DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database.sqlite

So, the database is in the database folder, what would the absolute path be? Thanks.

0 likes
2 replies
MichalOravec's avatar
Level 75

This is default

'sqlite' => [
    'driver' => 'sqlite',
    'url' => env('DATABASE_URL'),
    'database' => env('DB_DATABASE', database_path('database.sqlite')),
    'prefix' => '',
    'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],

So you just remove DB_DATABASE from your .env file

Please or to participate in this conversation.