Skip to main content

Move to MySQL or MariaDB

Moves every leaderboard, score, score history, hologram, sign, head and NPC from data.json to a MySQL or MariaDB database, without a restart. Why and when: Storage and Backups.

You need a database and a user that can create tables in it.

1. Export​

/lb admin → Export Data (or /lb admin export). The message says how many records were written to plugins/NexalLeaderboards/export/.

2. Fill in the database​

In plugins/NexalLeaderboards/config.yml:

storage:
type: sql
sql:
host: localhost
port: 3306
database: minecraft
username: minecraft
password: "your password"

3. Reload​

/lb admin → Reload (or /lb admin reload).

  • Switched storage to SQL: it is connected, and the tables are created.
  • Could not open SQL storage, kept the previous one: the login or the address is wrong. The console says why. Nothing changed; fix config.yml and reload again.

4. Import​

/lb admin → Import Data, with a shift left click (or /lb admin import). The message says how many records were imported.

Check it​

  • /lb list shows your leaderboards with their player counts, as before.
  • /lb top <leaderboard> shows the same ranking as before.
  • Holograms, signs and NPCs are where they were.

Keep data.json and the export/ folder for a while as a backup. Going back to JSON is the same four steps with type: json.