Minecraft

Connecting Minecraft Plugins to MySQL: LuckPerms, CoreProtect and More

Why and how to move Minecraft plugins from local files to MySQL — LuckPerms and CoreProtect configuration, sharing data across a network, pools, migration and backups.

On this page
  1. Why use a database
  2. Get a database
  3. Example: LuckPerms
  4. Example: CoreProtect
  5. Other plugins that benefit
  6. Organise the database
  7. Connection pools and limits
  8. Security
  9. Backups
  10. Troubleshooting
  11. Summary

Out of the box, most Minecraft plugins store data in local files — YAML, JSON or an SQLite database inside the plugin’s folder. That’s fine for a small server. As a server grows, or becomes a network, moving that data into MySQL (or MariaDB, or PostgreSQL where supported) brings real benefits. This guide explains when to do it and how, with LuckPerms and CoreProtect as worked examples.

Why use a database

  • Share data across servers. On a Velocity network, LuckPerms ranks, bans, economy balances and player stats can follow players from lobby to survival to minigames — because every server reads the same database.
  • Handle large datasets. CoreProtect logs every block change. On a busy server that’s millions of rows; a proper database handles lookups and rollbacks on large tables far better than a local SQLite file.
  • Access from outside the game. Websites, Discord bots and dashboards can read player stats or rank data.
  • Cleaner backups. Database dumps are consistent snapshots, and restoring them doesn’t require touching world files.

For a single small server with a handful of plugins, local storage is perfectly fine. Move to a database when you hit one of the reasons above.

Get a database

You’ll need a MySQL or MariaDB server with:

  • a database (for example minecraft),
  • a user with permissions on that database,
  • the host and port (usually 3306).

Every paid Kerit Cloud Minecraft server includes a free MySQL or PostgreSQL database with daily backups — no separate purchase. For heavy workloads, standalone database plans give dedicated resources and longer backup retention.

Keep the database close to the Minecraft server — the same data centre or region. Plugins query the database during gameplay, and every millisecond of network latency adds up.

Example: LuckPerms

In plugins/LuckPerms/config.yml:

storage-method: MySQL

data:
  address: db-host:3306
  database: minecraft
  username: mc_user
  password: 'your-password'
  pool-settings:
    maximum-pool-size: 10
    minimum-idle: 10
  table-prefix: 'luckperms_'

For a network, also enable a messaging service so a rank change on one server is pushed to the others immediately:

messaging-service: sql

(pluginmsg, which uses the proxy connection, and Redis are other options.) Install LuckPerms on every backend and on the Velocity proxy, all pointing at the same database.

Migrating existing LuckPerms data

Before switching storage, export your current data, change the config, then import:

/lp export backup        # while still on the old storage
# change storage-method to MySQL and restart
/lp import backup

Example: CoreProtect

In plugins/CoreProtect/config.yml:

use-mysql: true
table-prefix: co_
mysql-host: db-host
mysql-port: 3306
mysql-database: minecraft
mysql-username: mc_user
mysql-password: your-password

CoreProtect’s data grows quickly on a busy server. Consider its data retention settings, and use the purge command (/co purge t:30d, for example) to remove old logs you no longer need — keeping the database lean makes lookups and rollbacks faster.

Switching CoreProtect to MySQL on an existing server starts a fresh log in the database; check CoreProtect’s documentation for current options if you need to carry old SQLite history over.

Other plugins that benefit

Many popular plugins support MySQL: punishment plugins, economy plugins, player analytics, authentication plugins for offline-mode setups, and web map plugins with database storage. The configuration pattern is nearly always the same — host, port, database, username, password and a table prefix. Check each plugin’s documentation for whether it also supports PostgreSQL.

Organise the database

  • One database with table prefixes — luckperms_, co_, eco_ — keeps everything in one place and is easy to back up.
  • Or one database per plugin, if you want to grant different users different access.
  • Use the utf8mb4 character set so player names, chat and item names with any Unicode characters store correctly.
  • Never share the database user with services outside your control.

Connection pools and limits

Each plugin opens a pool of connections. Several plugins on several servers can add up to a lot of connections, and database servers have limits. If you see “Too many connections” errors:

  • Lower each plugin’s pool size — many default to 10, and 3–5 is often plenty for a single server.
  • Count the total: plugins × pool size × servers.
  • Upgrade to a database plan with a higher connection limit if you genuinely need more.

See connection limits and pooling.

Security

  • Store credentials only in plugin configs on the server — never in public repositories or screenshots.
  • Use a strong, unique password for the database user.
  • Don’t expose the database to the internet unless necessary; if you must, restrict it to your servers’ IPs and require SSL. See public SSL connections and IP whitelisting.
  • Give the database user only the permissions it needs on its own database.

Backups

Your world backups don’t include database data. Back up the database on the same schedule — daily, and before any plugin update or migration:

mysqldump --single-transaction -h db-host -u mc_user -p minecraft > minecraft-$(date +%F).sql

On Kerit Cloud, the included database is backed up daily automatically. Minecraft server backups covers the full plan.

Troubleshooting

Communications link failure / connection refused — wrong host or port, the database isn’t reachable from the server, or a firewall blocks it.

Access denied for user — wrong username or password, or the user lacks permission on that database or from that host.

Plugin falls back to local storage — the connection failed at startup; check the startup log for the plugin’s error.

Slow commands after switching — the database is far away (check the region) or overloaded; also check pool settings.

Summary

Move Minecraft plugin data to MySQL when you run a network, have large datasets like CoreProtect logs, or want outside access. Point each plugin at the same database with a table prefix, keep the database near your server, enable LuckPerms’ messaging service on networks, migrate with export and import commands, keep pool sizes modest, secure the credentials, and back up the database alongside your worlds.