Move from MySQL to SQLite
Homarr v2 supports SQLite (the default) and PostgreSQL. MySQL installations must convert before upgrading to v2.
The standalone converter is tested against the Homarr v1.77.1 database schema and writes its corresponding SQLite database. Homarr v2 applies its normal migrations when it first opens that file. The converter does not modify the source database.
Before converting
- Back up the MySQL database,
/appdata, your deployment configuration, andSECRET_ENCRYPTION_KEY. Keep the previous Homarr image available for rollback. - Upgrade to the latest stable v1 release (v1.77.1 at the tested baseline) first and let its migrations finish successfully. Back up that database before continuing.
- Stop every Homarr instance that writes to this database. Leave MySQL running and keep Homarr stopped throughout conversion and cutover.
The converter validates the schema and migration journal against v1.77.1; it does not identify the application binary version. Older releases with identical schemas are compatible. Different schemas, incomplete migrations, and existing output files are rejected.
Convert
From a checkout containing tools/mysql-to-sqlite, build the converter:
docker build -t homarr-mysql-to-sqlite tools/mysql-to-sqlite
mkdir -p convertedCreate mysql-conversion.env with credentials for the source database:
MYSQL_HOST=mysql.example.com
MYSQL_PORT=3306
MYSQL_USER=homarr
MYSQL_PASSWORD=replace-with-your-password
MYSQL_DATABASE=homarrMYSQL_PORT defaults to 3306. Use a host reachable from the converter container; localhost refers to the container itself. Keep this credentials file out of version control.
Run the converter after stopping Homarr:
docker run --rm --user "$(id -u):$(id -g)" --env-file mysql-conversion.env \
-v "$(pwd)/converted:/output" \
homarr-mysql-to-sqlite --output /output/db.sqlite --homarr-stoppedRunning as your user keeps the output file readable by you. The required --homarr-stopped flag confirms that you stopped Homarr; it does not stop your deployment. Wait for the converter to exit successfully before using converted/db.sqlite.
For a TLS connection, add MYSQL_SSL_CA=/certs/mysql-ca.pem to the env file and mount the PEM certificate with -v "$(pwd)/mysql-ca.pem:/certs/mysql-ca.pem:ro". The certificate file must be readable by the container user.
Start Homarr v2
- Keep a separate copy of the converted file before the first v2 startup.
- Place
db.sqliteat/appdata/db/db.sqlitein the appdata volume used by Homarr. Ensure the Homarr process can write to the file and its directory. - Set
DB_DRIVER=better-sqlite3andDB_URL=/appdata/db/db.sqlite. Remove the previous MySQL connection settings; if you explicitly setDB_DIALECT, change it tosqlite. - Preserve the original
/appdatafiles and the sameSECRET_ENCRYPTION_KEY. The converter copies encrypted values without re-encrypting them; a different key will make those secrets unreadable. - Start Homarr v2 and wait for its database migrations to finish. Check the startup logs, sign in, and verify your boards, users, integrations, and uploaded files.
The converter output is a raw SQLite database. Do not upload it to the backup ZIP import page.
Roll back
Stop Homarr v2, then restore your previous deployment configuration, image, appdata backup, and encryption key, pointing it at the preserved MySQL database. Do not open the v2 SQLite database with the older Homarr image.
Changes made after switching to SQLite are not synchronized back to MySQL. Keep the original database and backups until you have verified the new installation.