SQL Databases and Minecraft: Why Your Large Server Needs a Proper Database
Most Minecraft servers start with flat-file storage — YAML files for player data, JSON for economy balances, text files for ban lists. For a 5-player private SMP, this is fine. For a 50-player public server, it is a performance and reliability disaster waiting to happen.
The Flat-File Problem at Scale
When 50 players are online simultaneously, every save operation on a flat-file data store must:
- Load the entire file into memory
- Modify the relevant data
- Write the entire file back to disk
With a 500 KB player data file written 20 times per minute, you are generating significant I/O. With multiple plugins all doing this simultaneously, you have disk contention. The result: random lag spikes that look like TPS drops but have no CPU cause.
A SQL database writes only the changed rows, handles concurrent reads elegantly, and operates through a persistent connection rather than repeated file opens.
Setting Up MariaDB
MariaDB is MySQL's community fork — faster for most workloads and free. Install on your server or use Space-Node's database add-on.
# Install on Ubuntu/Debian
sudo apt install mariadb-server
sudo mysql_secure_installation
# Create a database for your server
mysql -u root -p
CREATE DATABASE minecraft_server;
CREATE USER 'mc_user'@'localhost' IDENTIFIED BY 'strong_password_here';
GRANT ALL PRIVILEGES ON minecraft_server.* TO 'mc_user'@'localhost';
FLUSH PRIVILEGES;
Migrating Plugins to Database Storage
Most major plugins support both flat-file and SQL storage. Switching is a one-time migration:
LuckPerms:
storage-method: mysql
data:
address: localhost
port: 3306
database: minecraft_server
username: mc_user
password: your_password
pool-settings:
maximum-pool-size: 10
EssentialsX (via separate database bridge plugin)
CoreProtect:
database-mysql: true
mysql-host: localhost
mysql-port: 3306
mysql-database: minecraft_server
mysql-username: mc_user
mysql-password: your_password
HikariCP Connection Pooling
The most common database performance mistake is reopening a connection for every query. Every major Minecraft plugin uses HikariCP — a connection pool that keeps a set of pre-established database connections ready to use instantly. Ensure maximum-pool-size is set to approximately the number of concurrent plugin threads (8–16 for most servers).
Performance Difference
On a busy server performing 500 database operations per minute:
| Storage | Avg operation time | Concurrent write handling | |---|---|---| | YAML flat-file | 12–45ms | Sequential (blocks) | | SQLite | 5–15ms | Limited concurrent | | MariaDB (HikariCP) | 0.5–3ms | Full concurrent |
The 10–90x improvement in operation speed under load is why no large server should be running flat-file storage.
Space-Node offers managed database add-ons for all hosting plans