Shift with red gradient lettering Skip to content

Common Errors

Laravel: Database file at path [database/database.sqlite] does not exist.

Illuminate\Database\QueryException: Database file at path [database/database.sqlite] does not exist.
Ensure this is an absolute path to the database. (Connection: sqlite, SQL: select * from "users")

Issue

Laravel is attempting to connect to an SQLite database which does not exist. The most likely cause of this error relates to a change in Laravel 11 where the default database driver changed from mysql to sqlite.

Solution

While this change is automated by the Laravel 11.x Shift, you may encounter this error if you upgraded manually or did not set the necessary ENV variables.

If you intend to use the sqlite database driver, then you are either missing the database file or have an incorrect path. For a missing database, you may run artisan migrate which will prompt you to create the database. If needed, you may set the path using the DB_DATABASE environment variable.

If you use another database driver, such as mysql, ensure you have set the DB_CONNECTION environment variable to mysql. For example:

DB_CONNECTION=mysql