Fix: Laravel Rust “database connection `sqlite` uses an unsupported or disabled driver”

Developer tutorial cover: Fix Laravel sqlite disabled driver, with Cargo.toml features in a code editor

You set up a Laravel Rust app, point it at SQLite in .env, run laravel migrate, and get this:

■ database connection `sqlite` uses an unsupported or disabled driver

Your .env looks right:

DB_CONNECTION=sqlite
DATABASE_URL=sqlite://storage/app/database.sqlite?mode=rwc

Those two lines are correct. The problem is in a different file.

Why it happens

In Laravel Rust, each database driver is a Cargo feature on the laravel-rust crate, so your app only compiles the drivers it uses. A new app enables database-postgres in Cargo.toml. If you change .env to SQLite but leave Cargo.toml alone, the app still has no SQLite driver compiled in. Laravel reads the sqlite: URL, finds that driver disabled, and stops with this message.

The Laravel docs list the three features:

Feature Databases
database-postgres PostgreSQL
database-mysql MySQL and MariaDB
database-sqlite SQLite

Step 1: Open Cargo.toml

In your project folder (the one with .env):

open -e Cargo.toml

Find the laravel-rust line under [dependencies]. A new app looks like this, though your version number may differ:

laravel-rust = { version = "0.1", features = ["database-postgres"] }

Step 2: Swap the feature

The docs say to replace database-postgres with database-sqlite:

laravel-rust = { version = "0.1", features = ["database-sqlite"] }

Keep the version number and any other features that are already on your line. Change only the database feature. If you also want PostgreSQL, you can list both features.

Step 3: Check the database folder exists

mode=rwc creates the database file on first use, but only if the parent folder already exists:

mkdir -p storage/app

Step 4: Run the migration again

laravel migrate

The Laravel CLI compiles your app first, so the first run takes longer than usual while Cargo rebuilds with the new feature. When the build finishes, the migrations create their tables in storage/app/database.sqlite. On my Mac the output ended with 3 migrations ran, for the users, cache and jobs tables.

If the database doesn’t exist, the docs say migrate offers to create it.

Step 5: Check it worked

ls -l storage/app/database.sqlite
laravel dev

The file should exist, and laravel dev should start without a database error. Then open http://127.0.0.1:8000.

Quick check

What you see What to do
Error mentions sqlite, .env is correct Swap the feature in Cargo.toml (Steps 1 and 2)
Build fails after editing Cargo.toml Check the line is valid TOML: quotes, commas and brackets
Error about opening or creating the file Run mkdir -p storage/app (Step 3)
You want PostgreSQL again Put database-postgres back and use a postgres:// URL

FAQ

Do I need to install SQLite? The docs say SQLite keeps the whole database in one file with no server to run, and the drivers are built through Cargo. I didn’t test whether any extra system library is needed on a Mac.

Why doesn’t .env alone switch databases? Because .env only chooses a connection at run time. The driver code itself is chosen at build time, in Cargo.toml.

Does the same apply to MySQL? Yes. Use the database-mysql feature and a mysql:// or mariadb:// URL.

Where is the full walkthrough? See How to Install Laravel Rust on macOS. If the laravel command itself isn’t found, see zsh: command not found: laravel.

Sources:

Leave a Reply