Pterodactyl MySQL
How to configure MySQL when running mineLogin inside Pterodactyl Docker containers.
Overview
When running your server inside Pterodactyl, each server instance runs in an isolated Docker container. This means localhost or 127.0.0.1 refers to the container itself, not the host machine where MySQL is running. You need to use the Docker host IP instead.
Configuration
database:
data-type: MYSQL
hostname: "172.18.0.1"
port: 3306
username: "minelogin"
password: "securepassword"
base: "mineLogin"
The IP address 172.18.0.1 is the default internal Docker host IP that allows containers to communicate with services running on the host machine.
Why Not localhost?
Using localhost or 127.0.0.1 would make mineLogin look for MySQL inside its own container, where no database server exists. The Docker host IP bridges the gap between the container and the host.
Finding Your Docker Host IP
Access the Pterodactyl console and run:
ip route | grep default
The IP address after via is your Docker host IP. In most Pterodactyl setups, this is 172.18.0.1.
MySQL Setup
Configure MySQL to Accept Docker Connections
By default, MySQL may only listen on 127.0.0.1. You need to bind it to 0.0.0.0 or the Docker bridge network IP.
Create a Database User
CREATE USER 'minelogin'@'172.18.0.%' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON mineLogin.* TO 'minelogin'@'172.18.0.%';
FLUSH PRIVILEGES;
The 172.18.0.% wildcard allows connections from any container on the Docker network.
Firewall
Ensure your firewall allows connections from the Docker network to MySQL (port 3306).
Troubleshooting
- Verify the Docker host IP using the method above
- Check MySQL logs for connection errors
- Confirm MySQL is running and bound to the correct address
- Validate that the database name, username, and password are correct
- Ensure the database exists before starting the plugin