Database Setup
Store SkinsRestorer data in a MySQL database.
SkinsRestorer can store skin data in MySQL instead of local files. MySQL lets multiple servers share the same skin data.
When to use database storage
Use MySQL when you:
- Run a proxy network (BungeeCord/Velocity) with multiple backend servers
- Want skin data shared across multiple servers
- Need the backend API to work on servers behind a proxy
- Have many players
Use local files when you:
- Run a single standalone server
- Do not need to share skin data between servers
- Want a simpler setup
Database configuration
Add this configuration to config.yml:
database:
enabled: true
host: localhost
port: 3306
database: skinsrestorer
username: sr_user
password: your_secure_password
maxPoolSize: 10
tablePrefix: sr_
connectionOptions: "sslMode=trust&serverTimezone=UTC"Configuration options
| Option | Default | Description |
|---|---|---|
enabled | false | Set to true to enable database storage |
host | localhost | MySQL server address |
port | 3306 | MySQL server port |
database | db | Database name |
username | root | Database username |
password | pass | Database password |
maxPoolSize | 10 | Maximum number of connections in the pool |
tablePrefix | sr_ | Prefix for all SkinsRestorer tables |
connectionOptions | sslMode=trust&serverTimezone=UTC | Additional connection parameters |
Setup guide
Create the database
Connect to your MySQL server. Then create a database for SkinsRestorer:
CREATE DATABASE skinsrestorer;Create a dedicated user
Create a MySQL user for SkinsRestorer:
CREATE USER 'sr_user'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON skinsrestorer.* TO 'sr_user'@'localhost';
FLUSH PRIVILEGES;If MySQL is on another computer, replace localhost with its host name.
If you must permit connections from any host, use %.
Configure SkinsRestorer
Add the database credentials to config.yml.
Restart your server
Restart the server. Read the console for connection errors.
Proxy network setup
On a proxy network, use the same database on the proxy and every backend server.
Backend servers need database access to use the SkinsRestorer API.
Keep server.proxyMode.api enabled in every backend configuration.
Example setup
- Set
database.enabled: trueon the proxy. - Add the same database credentials to each backend server.
- Make sure that the proxy and every backend server can connect to MySQL.
SSL/TLS configuration
The connectionOptions value controls the SSL connection:
| SSL Mode | Use case |
|---|---|
sslMode=trust | Trust any certificate (development/internal networks) |
sslMode=disable | Disable SSL entirely (not recommended for production) |
sslMode=verify-ca | Require a server certificate from the configured CA |
sslMode=verify-identity | Require a valid certificate and hostname (most secure) |
For production environments with SSL certificates:
connectionOptions: "sslMode=verify-ca&serverTimezone=UTC"Migrating from file storage
SkinsRestorer does not copy local file data to MySQL. When you enable MySQL, the database starts empty.
To restore custom skins:
- Record each custom skin that you created with
/sr createcustom. - Enable MySQL storage.
- Create the custom skins again with the same commands.
After players rejoin, they can select their skins again.
Troubleshooting
Connection refused
- Make sure that MySQL accepts connections.
- Make sure that the host and port are correct.
- Allow MySQL traffic on port 3306 through the firewall.
Access denied
- Make sure that the username and password are correct.
- Grant the MySQL user access to the database.
- For a remote connection, permit the Minecraft server's IP address.
SSL errors
- For a temporary test, use
sslMode=trustorsslMode=disable. - For production, configure trusted SSL certificates.
Timezone errors
- Add
serverTimezone=UTCtoconnectionOptions. - To use a specific timezone, set a value such as
serverTimezone=America/New_York.
Performance tuning
Connection pool size
The maxPoolSize option sets the maximum number of database connections.
- Small servers (< 100 players): 5-10 connections
- Medium servers (100-500 players): 10-20 connections
- Large networks (500+ players): 20-50 connections
Do not set a value that MySQL cannot support. Each connection uses resources, and MySQL limits the total number of connections.
Table prefix
If multiple SkinsRestorer installations share one database, give each installation a different tablePrefix.
How is this guide?
Last updated on