Minecraft MPDB Setup
Debian / Ubuntu
Overview
Setup the MySQL Player Data Bridge (MPDB) plugin on a PaperMC Minecraft server.
Assumptions
MariaDB Setup completed.
Minecraft Server Setup completed.
Logged in as administrative user.
Setup Database
Open a MariaDB session as an administrative user. Enter the password when prompted.
mariadb -u sqladmin -pCreate Database
Create a new database named mpdb.
CREATE DATABASE IF NOT EXISTS mpdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;Create User
Create a SQL user to access the mpdb database: mpdbuser. When generating a password, keep it at 41 characters with the mysql_native_password plugin.
CREATE USER 'mpdbuser'@'localhost' IDENTIFIED BY 'Generated_Secure_Password';Database Permissions
Grant the mpdbuser user access to the mpdb database.
GRANT ALL PRIVILEGES ON mpdb.* TO 'mpdbuser'@'localhost';Plugin Setup
Download and Install the MySQL Player Data Bridge plugin.
Download MySQL Player Data Bridge
Download the MySQL Player Data Bridge plugin on SpigotMC .
Upload the file to the server using SCP, SFTP, or SSH. If using a hosting provider, you may be able to do this with the web interface.
The following command is an example using scp, replace the values as required.
$HOME/Downloads/MysqlPlayerDataBridge-v4.11.0.jar: Path to the plugin file, verify it and the version number are correct.serveruser: User with SSH capabilities on the Minecraft server.192.168.1.255: Hostname or IP address of the server./tmp: Where to copy file, this guide will assume it is copied to the/tmpdirectory.-i $HOME/.ssh/path-to-private-key: Private key file to use for authentication.
Password Example
scp $HOME/Downloads/MysqlPlayerDataBridge-v4.11.0.jar [email protected]:/tmpPrivate Key Example
scp $HOME/Downloads/MysqlPlayerDataBridge-v4.11.0.jar [email protected]:/tmp -i $HOME/.ssh/path-to-private-keyInstall MySQL Player Data Bridge
On the Minecraft server, copy the plugin file to the plugins directory within the Minecraft server directory.
cp /tmp/MysqlPlayerDataBridge-v4.11.0.jar /opt/minecraft/server/plugins/Modify the file permissions as required.
chown minecraft:minecraft /opt/minecraft/server/plugins/MysqlPlayerDataBridge-v4.11.0.jarchmod 640 /opt/minecraft/server/plugins/MysqlPlayerDataBridge-v4.11.0.jarRestart Minecraft to generate the configuration files for MySQL Player Data Bridge.
sudo systemctl stop minecraft && sudo systemctl start minecraftConfigure MPDB
Open the MPDB configuration file in an editor. The configuration file is well-commented and should be reviewed fully to get the most out of the plugin. Find the config.yml file in the plugins/MysqlPlayerDataBridge directory.
nano /opt/minecraft/server/plugins/MysqlPlayerDataBridge/config.ymlDatabase
Configure the database based on the information used to create the database in MariaDB. Refer to the following table for notable settings.
| Setting | Value | Description |
|---|---|---|
| host | 127.0.0.1 | Hostname or IP address of database, leave unchanged when the database is on the same system. |
| port | 3306 | Default SQL port, leave unchanged unless a different port is specified by a vendor. |
| databaseName | mpdb | The name of the created database. |
| user | mpdbuser | Username of the created MariaDB SQL user. |
| password | Generated_Secure_Password | Password for the specified user. |
| sslEnabled | false | Leave disabled on localhost, when connecting to a remote database it is highly recommended. Requires the database host to support SSL. |
The following is an example database configuration.
database:
mysql:
#MySQL server address
host: 127.0.0.1
#MySQL server port (default 3306)
port: 3306
#Database name (NOTE! You need to create the database, then the plugin will create the tables.)
databaseName: 'mpdb'
#Tables names (the plugin will auto create them)
TablesNames:
#Inventory and Armor table name.
inventoryTableName: 'mpdb_inventory'
#Enderchest table name.
enderchestTableName: 'mpdb_enderchest'
#Experience table name.
experienceTableName: 'mpdb_experience'
#PotionEffects table name.
potionEffectsTableName: 'mpdb_potionEffects'
#Health, food and air table name.
healthFoodAirTableName: 'mpdb_health_food_air'
#Location table name.
locationTableName: 'mpdb_location'
#Economy table name.
economyTableName: 'mpdb_economy'
#User name
user: 'mpdbuser'
#User password
password: 'Generated_Secure_Password'
#SSL connection
sslEnabled: false
#This maintenance task runs async with a 2 min delay after the server starts.
removeOldAccounts:
#Enable or disable database clean up of old accounts. | (true or false)
enabled: false
#Inactivity in days. Default 60 days.
inactivity: 360New Players Commands
Example player commands will be present after generating the configuration file. These commands will run the first time a player joins the server.
Modify, remove, or add any desired commands.
New-Players-Cmd:
- 'tell <PlayerName> Cmd 1 sample - you should remove this from the MPDB config'
- 'tell <PlayerName> Cmd 2 sample - you should remove this from the MPDB config'References
brunyman. “MySQL Player Data Bridge .” 2023. ↩︎
brunyman. “MPDB GitHub .” 2020. ↩︎
Fandom. “Minecraft Wiki .” 2024. ↩︎
MariaDB. “MariaDB Documentation .” 2024. ↩︎
MariaDB. “MariaDB Knowledge Base .” 2024. ↩︎
Oracle. “MySQL Documentation .” 2024. ↩︎