CYBER DEAL UP TO -40% FIRST YEAR
Glossary background texture

MySQL

MySQL is a database management system that stores data in organized tables rather than flat files. For Minecraft servers, MySQL handles plugin data like player permissions, economy balances, claim information, and statistics across multiple servers.

While most plugins use flat files (YAML, JSON) by default, MySQL becomes essential when running server networks that need to share data between multiple instances or when dealing with large amounts of data that would slow down file-based storage.


What Is MySQL?

MySQL is a relational database system that organizes information into structured tables with rows and columns. Think of it like a spreadsheet but much more powerful and efficient. Each table has a schema defining what type of data goes in each column (text, numbers, dates), and you can link tables together to create relationships between different types of data.

For Minecraft servers, MySQL replaces plugin data files:

  • LuckPerms stores permissions in MySQL instead of hundreds of YAML files
  • CoreProtect logs block changes to MySQL instead of flat files
  • Economy plugins store player balances in database tables
  • Claim plugins track protected regions in the database

The advantage is speed and reliability when dealing with thousands or millions of records.


Comparison: MySQL vs SQLite

Many plugins support both MySQL and SQLite. Understanding the difference helps you choose:

Feature MySQL SQLite
Architecture Client server, runs as separate service Embedded, single file in plugin folder
Setup complexity Requires database credentials Works automatically, no setup
Network support Can be accessed remotely by multiple servers Local to one server only
Concurrent writes Handles many simultaneous writes well Single writer at a time, can bottleneck
Performance Better for heavy write workloads and high concurrency Faster for read heavy workloads with low traffic
Data size Handles gigabytes to terabytes efficiently Best under 1 GB, slows down beyond that
Best for Server networks, high player counts, shared data Single servers, small to medium data

For most single server setups under 50 players, SQLite works fine and requires zero configuration. For networks or high traffic servers, MySQL is the better choice.


Why Use MySQL on Minecraft Servers?

Sharing data between servers:

If you run a BungeeCord or Velocity network with multiple backend servers (lobby, survival, minigames), MySQL lets plugins share data. Set up LuckPerms with MySQL and all your servers use the same permission groups. Players have consistent ranks everywhere.

Better performance with large datasets:

CoreProtect logging millions of block changes performs better with MySQL than flat files. Searching block history in MySQL takes seconds. File-based storage can take minutes as files grow.

Centralized management:

View and edit data from external tools. Use phpMyAdmin or database clients to bulk edit permissions, reset player data, or generate reports without logging into the server.

Data persistence across server changes:

Moving to a new host or changing server types? MySQL data stays intact in the database. Just point your new server at the same database credentials.

Reduced disk I/O:

Instead of reading and writing hundreds of small files, plugins make database queries. This reduces disk operations and can improve overall server performance, especially on slower storage.


When NOT to Use MySQL

Single server with light data:

If you're running one survival server with 10 plugins and 20 regular players, flat files work perfectly. MySQL adds complexity without benefit.

Plugins that don't benefit from it:

Many plugins offer MySQL support but aren't designed to take advantage of it. If a plugin just copies flat files into database tables without optimizing queries, you gain nothing and add overhead.

No technical knowledge:

MySQL requires understanding connection strings, credentials, and basic database concepts. If you're not comfortable with these, stick with default storage methods until you need MySQL.

Shared hosting with MySQL limits:

Some budget hosts limit database connections or queries per hour. Heavy MySQL usage can hit these limits and cause plugin failures.


Common Plugins That Use MySQL

  • LuckPerms: Permissions management. MySQL enables syncing ranks across server networks.
  • CoreProtect: Block logging and rollback. MySQL handles millions of logged actions efficiently.
  • Vault Economy plugins: Most economy plugins (EssentialsX, CMI) can use MySQL to share balances across servers.
  • Lands/GriefPrevention: Claim plugins with MySQL support for cross-server claims.
  • AdvancedBan: Ban management that syncs bans across multiple servers instantly.
  • Votifier listeners: Voting reward plugins that track votes in MySQL for analytics.

MySQL Connection Strings Explained

Plugins need four pieces of information to connect:

Host: Where the MySQL server is. Common values:

  • localhost if MySQL runs on the same machine as your Minecraft server
  • 127.0.0.1 (same as localhost but more explicit)
  • An IP address like 123.45.67.89 for remote databases
  • A hostname like mysql.yourhost.com

Port: Usually 3306 (MySQL's default port). Include it as host:3306.

Database name: The specific database to use. One MySQL server can host multiple databases. Specify which one holds your plugin data.

Username and password: Credentials for authentication. Never use root accounts. Create dedicated users per plugin or server for security.


Troubleshooting MySQL Connections

"Could not connect to MySQL server":

  • Check hostname, port, username, and password for typos
  • Verify the MySQL service is running
  • Confirm your Minecraft server's IP is allowed to connect (whitelist in MySQL settings)
  • Check firewall rules if using remote MySQL

"Access denied for user":

Wrong username or password. Double check credentials. Some hosts change passwords when resetting databases.

"Unknown database":

The database name doesn't exist. Create it first in your control panel, then configure plugins.

"Too many connections":

Your MySQL server hit its connection limit. Increase max_connections in MySQL config or reduce connection pool sizes in plugin configs.

Slow query performance:

Database tables need indexing. Most plugins create indexes automatically, but poorly written plugins may not. Consult the plugin documentation or a database administrator.


Security Best Practices

  • Use unique passwords: Never reuse passwords across databases or servers.
  • Create dedicated users: Don't use root or admin accounts for plugin connections. Create a user with permissions only for the specific database.
  • Restrict remote access: If using remote MySQL, whitelist only the IPs that need access. Don't expose MySQL to the entire internet.
  • Regular backups: Back up your MySQL databases separately from world files. Many hosts offer automatic database backups, but verify this.
  • Keep MySQL updated: Old MySQL versions have security vulnerabilities. Use MySQL 8.0 or MariaDB 10.5+ for modern security and performance.
Don't miss out

CYBER DEAL
UP TO -40%

Host a Minecraft Server today with the best Cyber deal discount

  • -40% First Month
  • -10% First Quarter
  • -40% First Year