Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Database (database.sqlite) does not exist." in Laravel?

I'm studying laravel then I switched mysql from sqlite. I deleted the database.sqlite file, configure the database.php to mysql and .env file.

I'm having a error "Database (database.sqlite) does not exist". How to fix this error?

like image 300
Van Adrian Cabrera Avatar asked Oct 14 '25 08:10

Van Adrian Cabrera


2 Answers

The sqlite driver doesn't create the database file if it doesn't exist.

The simple solution is to create an empty file just before migrating the database into it (filling the file with schemas and data)

Simply put, this command will fix it:

 touch database/database.sqlite
like image 161
Atrakeur Avatar answered Oct 17 '25 00:10

Atrakeur


You don't need anything in the .env file except the DB_CONNECTION key/value pair. When you are using SQLite, remove all of the following keys:

DB_HOST

DB_PORT

DB_DATABASE

DB_USERNAME

DB_PASSWORD

like image 25
OLIVIERS Avatar answered Oct 16 '25 23:10

OLIVIERS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!