TDXDevelopment
TDX LeaderboardsConfiguration

storage

SQLite vs MySQL, when to use which, the MySQL keys and what switching backends means.

TDX Leaderboards ships with two storage backends. Pick the one that matches your setup, not the one that sounds fancier.

Changing the backend or anything in the mysql block needs a full restart. /lbadmin reload does not reopen the database.

Which one should I use?

  • SQLite, the default. Zero configuration, runs in WAL mode, lives in plugins/TDXLeaderboards/data.db. This is the right answer for most servers.
  • MySQL / MariaDB, when you want the data in an external database you already run and back up. Works with MySQL 8+ and MariaDB 10.5+.

If you are not sure, stay on SQLite.

Quick example

plugins/TDXLeaderboards/config.yml
general:
  storage: sqlite
# no further configuration required

The data file is plugins/TDXLeaderboards/data.db. While the server runs you will also see data.db-wal and data.db-shm next to it. Back up all three together, or stop the server first.

plugins/TDXLeaderboards/config.yml
general:
  storage: mysql

mysql:
  host: "localhost"
  port: 3306
  database: "tdxleaderboards"
  username: "root"
  password: ""
  table-prefix: "tdxlb_"
  pool-size: 10

Reference (mysql block)

KeyTypeDefaultNotes
hoststringlocalhostHostname or IP of the database.
portint3306
databasestringtdxleaderboardsMust already exist. The plugin creates its tables, not the database.
usernamestringrootNeeds CREATE, ALTER and full read and write access in that database.
passwordstringemptyPlain text. Restrict file permissions on config.yml accordingly.
table-prefixstringtdxlb_Put in front of every table name.
pool-sizeint10Connections kept in the pool. 10 is fine for most servers, raise it at 200+ players.

The connection does not use SSL and there is no key to switch it on, so keep the database on the same machine or a private network.

Several servers, one database

There is no per-server id. Two servers that point at the same database with the same table-prefix read and write the same tables.

To keep each server's boards separate inside one database, give every server its own prefix, for example tdxlb_survival_ and tdxlb_skyblock_. Each prefix gets its own full set of tables.

Switching from SQLite to MySQL

There is no built-in migration. When you switch general.storage to mysql and restart, the plugin creates empty tables and starts from nothing. Your data.db is left untouched, so switching back brings everything back as it was.

What an empty start means in practice:

  • This period's standings, points and custom counters start again.
  • Permanent milestone flags are gone, so milestones can be earned a second time.
  • The archive of past periods is empty.
  • Rewards still waiting for offline winners are not carried over.

See Switch from SQLite to MySQL for the least painful way to do it.

Never point the plugin at a half-copied database, and never run two servers against the same SQLite file. Decide on one backend, switch while the server is stopped, and keep the old data.db until you are sure.