Migrate SQLite to MySQL
Move an existing single-server install to a shared MySQL backend without losing leaderboard history.
You started on SQLite (the default), and now you want to move to MySQL — either to share data across multiple Paper backends, or to back up to a managed database. This guide walks the migration end-to-end.
Back up plugins/TDXLeaderboards/data.db before you start. If
anything goes wrong, copying it back is the entire rollback plan.
What this guide assumes
- You currently have one server running TDX Leaderboards on SQLite
- You have a MySQL (or MariaDB) instance reachable from the server
- The MySQL user can
CREATE TABLEin the target database
Steps
Stop the server
A clean stop flushes the in-memory caches to data.db so nothing is
lost between the snapshot you're about to take and the file on disk.
/stopTake a backup of data.db
plugins/TDXLeaderboards/
├── data.db ← copy this somewhere safe
└── data.db.backup ← e.g. like thisCreate the MySQL database
Run this once on your MySQL host. Replace the name and password with your own.
CREATE DATABASE tdx_leaderboards CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'tdx'@'%' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON tdx_leaderboards.* TO 'tdx'@'%';
FLUSH PRIVILEGES;Switch the plugin to MySQL
Edit plugins/TDXLeaderboards/config.yml and change the storage
block:
storage:
type: MYSQL
mysql:
host: "db.your-host.tld"
port: 3306
database: "tdx_leaderboards"
username: "tdx"
password: "a-strong-password"
use-ssl: true
pool-size: 8Don't start the server yet — we still need to import the SQLite data.
Import the SQLite data
Place your backed-up data.db next to the plugin jar and start the
server with the special import flag:
/lbadmin migrate import-from-sqlite ./data.db.backupThe plugin streams every row from the SQLite file into the MySQL schema, preserving UUIDs, milestone state, and historical period totals. On a normal install this takes a few seconds.
Verify
/lbadmin status
/leaderboardstatus will show Storage: MYSQL and the row count for each table.
The GUI should look identical to before — same boards, same names,
same numbers.
(Optional) Point a second server at the same database
If the whole reason you migrated was to share data across servers,
just install TDX Leaderboards on the second backend and copy the same
storage: block over. The plugin's per-server scoping stays
consistent because it keys on the player UUID, not the server name.
Rollback
If something looks wrong:
- Stop the server.
- Switch the
storage.typeback toSQLITE. - Restore your
data.dbbackup. - Start the server.
You're back where you started, no data loss.