Skip to content

Use with a database

Maxime Malgorn edited this page Jan 29, 2020 · 2 revisions

The plugin can save player enderchests and backups to a database if needed.
In order to activate this storage, you have to edit your config.yml file.

The plugin only supports MySQL databases for now.
Do you need additional support? Open an issue!

1. Configure the connection to your database server

Open your config.yml file and find the section called mysql. Edit options as described below.

Key Description
enabled set it to true
host host of your database server
port port of your database server
user username used to connect to the database
password password used to connect to the database
database your database name
tablePrefix optional: string used before plugin tables

2. Secure the connection with SSL!

By default the plugin opens the connection without using SSL. But you should use encrypted connections to your database server because its much more secure. To do so, you have to do a little bit more of configuration (less than 10 minutes).

ℹ️ If you are using MySQL 8+, steps 1 and 2 are automatically done at the startup. So you just have to get certificate and key files from the data folder. ⚠️ The plugin only supports PKCS12 keystore type.

  1. You need to get or generate certificates from your MySQL server as explained here.

  2. Configure your database server to use SSL as explained here.

  3. Generate keystore files from these certificates and keys (more info here):

    For example to generate a keystore for the client certificate with the password "changeit":
    openssl pkcs12 -export -in client-cert.pem -inkey client-key.pem -passout pass:changeit -out client-keystore.p12

    And if your are using a custom CA, you need to generate its keystore too:
    openssl pkcs12 -export -in ca.pem -inkey ca-key.pem -passout pass:changeit -out ca-keystore.p12

  4. Configure the plugin to use these keystores:

mysql:
  # Basic configuration before [...]

  ssl:
    enabled: true
    keystore_file: '/home/path/to/client-keystore.p12'
    keystore_password: 'changeit'
    # if your are using a custom CA:
    ca_keystore_file: '/home/path/to/ca-keystore.p12'
    ca_keystore_password: 'changeit'
  1. And you are ready to go! Reload the configuration and you should see a message noticing you the usage of a secured connection to your database server.
Clone this wiki locally