Most plugins store their data in files in their own folder. For large amounts of data (block history in CoreProtect) or for sharing data between several servers (LuckPerms permissions on a network behind a proxy), a MySQL database works better. This guide shows how to create one at StormHost, how to connect LuckPerms and CoreProtect to it and how to access it from your computer.
What you'll need
- A Minecraft server at StormHost with a plugin that supports MySQL
- The Databases and Files permissions if you don't own the server
- About 15 minutes
When to use MySQL instead of files#
| Situation | Files (default) | MySQL |
|---|---|---|
| One server, a normal number of players | Good enough | Not needed |
| A network of servers behind a Velocity proxy with shared permissions | Not possible | Required – all servers must read the same data |
| CoreProtect on a big, long-running server | Works, but the file keeps growing | Better handling of large data |
| You want to browse or edit the data from your computer | Complicated | Easy (HeidiSQL, DBeaver) |
| A website that reads statistics from the server | Not possible | Yes |
Creating a database#
In the customer area, open My services, click your Minecraft server and go to the Database tab.
Type a short name in the Database name field, for example
luckperms. Letters without accents, digits and underscores are allowed, up to 48 characters.Leave the Allowed connections from field at
%(see below).Click Create database.
The new database appears in the list with the Host, User, Allowed connections from and Password details.
| Detail | What it is | Where you enter it |
|---|---|---|
| Database name (at the top of the database) | The actual database name. The system may add a prefix to the name you chose. | In the plugin's “database” field. Always copy exactly what you see. |
| Host | The database server address in the form address:port. | In the “host”/“address” field, and the port in the “port” field. |
| User | The database login name (generated). | In the “username”/“user” field. |
| Password | The password (shown after you click it). | In the “password” field. |
| Allowed connections from | Where the database can be connected to from: % = anywhere, otherwise a single IP address. | Nowhere, it's just for information. |
Allowed connections from
If you enter a specific IP address (for example your home one), the database accepts connections only from that address. Not even your Minecraft server will be able to connect, because it connects from a different address. So leave it at % and rely on the strong generated password. The value can't be changed after the database is created – you'd have to create a new database.
Other buttons:
- New password – generates a new password. The old one stops working, so enter the new one right away in the configuration of every plugin that uses the database, and restart the server.
- Delete – deletes the database along with all its data.
Deleting a database
Deleting can't be undone, and the data isn't in the server backups. Export the database before deleting it (see Database backups).
The number of databases depends on your plan. Above the list you'll see Used 1 of 10. When the limit is used up, you'll see The limit has been reached. Several plugins can share one database – each uses its own tables with its own prefix (LuckPerms luckperms_, CoreProtect co_).
LuckPerms#
Already have permissions set up?
After switching to MySQL, LuckPerms starts with an empty database. If you already have groups and permissions on the server, export them first as described in Moving existing permissions to MySQL, and only then continue.
Stop the server.
In the Files tab, open
plugins/.LuckPerms/ config. yml Find
storage-methodand thedatasection and change them:plugins/ LuckPerms/ YAMLconfig.yml storage-method: mysql data: address: <HOST> database: <DATABASE_NAME> username: <USER> password: '<PASSWORD>'Replace
<HOST>,<DATABASE_NAME>,<USER>and<PASSWORD>with the details from the Database tab, always without the angle brackets. Keep the single quotes around the password.Save the file (Ctrl+S) and start the server.
| Setting | What it does | Recommended value | When to change it |
|---|---|---|---|
storage-method | Where LuckPerms stores data: h2 (a file, the default), mysql, mariadb, yaml and others. | mysql | mariadb if you know the database server is MariaDB (LuckPerms recommends it). |
data.address | The database address. The port goes after a colon (address:port). | The Host value | When you change databases. |
data.database | The database name. It must already exist. | The name from the Database tab | – |
data.username, data.password | Login details. | From the Database tab | After clicking New password. |
data. | How many database connections LuckPerms keeps open. | 10 | Lower it (for example to 5) if the database reports too many connections. |
data. | Extra connection parameters. | useUnicode: true, characterEncoding: utf8 | Add useSSL: false if you get an SSL warning. |
data.table-prefix | The table prefix. | 'luckperms_' | A different prefix when two servers should keep separate data in one database. |
server (at the top of the file) | The server name for permissions that apply only on one server in a network. | global | On a network behind a proxy, a different one for each server (lobby, survival). |
Special characters in the password
Always put the password in single quotes '…'. Otherwise YAML would read characters like #, : or % as syntax. If the password contains an apostrophe ', write it twice ('').
Moving existing permissions to MySQL#
If you already have permissions in the original storage, move them over:
Before changing
storage-method, type this in the console:text lp export zaloha-opravnenilp export– saves all LuckPerms data to a file.zaloha-opravneni– the file name. This createsplugins/.LuckPerms/ zaloha-opravneni. json. gz
Stop the server, change
config.ymlas described above and start the server.Type this in the console:
text lp import zaloha-opravneni.json.gzType the file name including the
.json.gzextension. The data is loaded into the new database.
CoreProtect#
Stop the server.
In the Files tab, open
plugins/and change:CoreProtect/ config. yml plugins/ CoreProtect/ YAMLconfig.yml use-mysql: true table-prefix: co_ mysql-host: <ADDRESS> mysql-port: <PORT> mysql-database: <DATABASE_NAME> mysql-username: <USER> mysql-password: '<PASSWORD>'Split the Host value from the Database tab: the part before the colon goes into
<ADDRESS>, the number after the colon into<PORT>.Save and start the server.
| Setting | What it does | Recommended value | When to change it |
|---|---|---|---|
use-mysql | Stores the history in MySQL instead of a file. | true | false to go back to the file. |
table-prefix | The prefix of CoreProtect's tables. | co_ | When CoreProtect from several servers uses one database. |
mysql-host | The database address without the port. | The part of Host before the colon | – |
mysql-port | The database port. | The part of Host after the colon | – |
mysql-database, mysql-username, mysql-password | The database name and login details. | From the Database tab | After clicking New password. |
Old history isn't carried over
When you switch to MySQL, CoreProtect starts a new history. The existing records stay in the file in the plugins/CoreProtect folder, but they won't be in MySQL. So switch right at the start, not after a year of running the server.
Newer CoreProtect versions (version 25 and later) have a database-type key instead of use-mysql. If you see it in the file, set database-type: mysql – it takes priority over use-mysql.
Other plugins#
Configurations differ, but the fields are almost always the same:
| Field in the plugin's configuration | What to enter |
|---|---|
host, hostname, address | The address from the Host value (without the port, if there's a separate port field). |
port | The port from the Host value. |
database, db-name | The database name. |
username, user | The user. |
password | The password (in quotes). |
useSSL, ssl | false if the plugin reports SSL problems. |
jdbc-url, url | The full address in the form jdbc: (for the MariaDB driver, jdbc:mariadb://…). |
Always restart the server after making changes. The /reload command often breaks plugins that use a database.
Access from your computer#
You can browse and edit the database on your computer. This works if Allowed connections from is set to %.
Windows
- Install HeidiSQL from heidisql.com (opens in a new window).
- In the session manager window, click New.
- As the Network type, choose MariaDB/MySQL (TCP/IP).
- Enter the address in Hostname / IP, the port in Port (both from the Host value), and the login details in User and Password.
- Click Open.
macOS
- Install DBeaver Community from dbeaver.io (opens in a new window).
- Choose Database › New Database Connection and the MySQL (or MariaDB) type.
- Fill in Server Host, Port, Database, Username and Password.
- Click Test Connection and then Finish.
Linux
Use DBeaver Community from dbeaver.io (opens in a new window) (same steps as on macOS), or a client in the terminal. On Ubuntu and Debian, install it with apt install mariadb-client and connect like this:
mariadb -h <ADDRESS> -P <PORT> -u <USER> -p <DATABASE_NAME>mariadb– the client for both MariaDB and MySQL.-h <ADDRESS>– the database server address.-P <PORT>– the port (capital P).-u <USER>– the user.-p– the program asks for the password (it isn't typed into the command, so it doesn't end up in your history).<DATABASE_NAME>– the database you want to work with.
Newer MariaDB clients (version 11.4 and later, for example on Debian 13) verify the database server's certificate by default. If the connection fails with a TLS/SSL error that mentions a certificate, add the --disable-ssl-verify-server-cert switch after mariadb (the client then doesn't check the server's certificate). If the error says the server doesn't support SSL, use the --disable-ssl switch instead.
Careful with edits
Don't change data while the server is running – plugins keep part of their data in memory and will overwrite your change. Always make an export before editing anything by hand.
Database backups#
Backups in the Backups tab only contain the server's files, not the databases. Export them separately:
- Connect to the database in HeidiSQL (see above).
- Click the database on the left and choose Tools › Export database as SQL.
- Tick both table creation and data, choose output to a
.sqlfile and click Export.
To restore: in HeidiSQL, select the database and choose File › Run SQL file. LuckPerms also has its own backup with the lp export <FILE_NAME> command.
Verification#
- LuckPerms: type
lp infoin the console. TheStoragesection must showType: MySQL(orMariaDB). - CoreProtect: type
co statusin the console. You'll see the lineDatabase: Using MySQL. - In HeidiSQL or DBeaver, you'll see new tables in the database (
luckperms_…,co_…).
Troubleshooting#
Communications link failure or Unable to connect to MySQL server.#
The plugin couldn't reach the database at all (the second message comes from CoreProtect). Check the address and port (the Host value, exactly, including the number after the colon). In CoreProtect, the address and port have to be in separate fields. If everything is correct, the database server may be temporarily unavailable – try again in a moment, or contact support.
Access denied for user '…'@'…' (using password: YES)#
The database rejected the user name or password:
- You changed the password with the New password button in the meantime and the plugin still has the old one.
- The password contains special characters and isn't in quotes.
- Allowed connections from contains a specific IP address the server doesn't connect from. Create a new database with
%.
Unknown database '…'#
The database name doesn't match. Copy it exactly from the Database tab, including any prefix.
Warning: Establishing SSL connection without server's identity verification is not recommended#
This is a warning from the MySQL driver. For LuckPerms, add useSSL: false and verifyServerCertificate: false to data.; for other plugins, look for a useSSL option.
Connection is not available, request timed out after 5000ms#
LuckPerms didn't get a connection from its pool. The database is unavailable, or the connection limit has been reached. Each server with LuckPerms keeps 10 connections by default – if more than that point at the database (a server network, other plugins), lower maximum-pool-size.
No operations allowed after connection closed#
The database closed an idle connection before the plugin renewed it. In LuckPerms, maximum-lifetime (in milliseconds) must be shorter than the database's timeout. The default of 30 minutes usually works.
Summary
- Create the database in the Database tab and leave Allowed connections from at
%. - Copy the details exactly, and put the password in single quotes in YAML.
- LuckPerms:
storage-method: mysqland thedatasection; move existing data over withlp exportandlp import. - CoreProtect:
use-mysql: true, enter the address and port separately; the old history isn't carried over. - Databases aren't included in server backups – export them separately (HeidiSQL).