Linux VPS
Connecting game plugins to MariaDB without opening it to everyone
Separate TCP timeouts from account errors, then connect a game plugin through a scoped firewall rule and verified encryption.

A plugin that reports a database timeout may have the correct password. A TCP connection can fail before MariaDB gets far enough to check credentials. Separate network reachability, database authentication and plugin configuration so you can fix one layer at a time.
These checks apply when you administer the database VPS. If a hosting panel provides the database, use its connection details and access controls or ask support to change the allowed source. Do not edit a shared database host or expose its listener yourself.
Test from the same place as the plugin
Write down the configured hostname, port, database name and user. Remove passwords before sharing logs. Then run a connection test from the game container or server that runs the plugin. A successful test from your laptop does not establish that the container has the same route.
For a shell with netcat installed, nc -vz -w 5 DB_HOST 3306 checks a TCP handshake. Substitute the real endpoint and port. A timeout suggests routing, filtering or an unreachable destination. A refused connection suggests no accepting listener or an explicit rejection. Neither result tests SQL permissions.
If TCP works, use a MariaDB client with the same account: mariadb --host=DB_HOST --port=3306 --user=PLUGIN_USER --password. The password flag prompts for the secret rather than placing it in the command. Keep TLS validation enabled and use the correct server name and trust configuration.
Listen on the intended interface
On the database host, inspect listeners with sudo ss -lntp and check the effective MariaDB configuration. A service listening only on loopback cannot accept a connection from another machine. MariaDB's remote-access guide covers bind addresses and networking settings.
Prefer a reachable private or VPN interface when both systems support it. Bind to the address you intend to use, then plan any required database restart. Save the current configuration first and verify that local applications still connect afterwards.
If you must use a public endpoint, pair that decision with a firewall rule limited to the required source. Do not start by allowing the whole internet to port 3306. Confirm the source address that reaches the database: a container network may translate it to the node's address.
Match the account to the actual source
MariaDB accounts include a username and host component. An account for localhost does not automatically grant the same username access from a remote game node. Check the account that matches the incoming connection and inspect its grants. The CREATE USER reference describes host-qualified accounts.
Create a dedicated plugin account for the required database. Grant only the permissions the plugin documents. Some plugins need schema creation or alteration during installation and upgrades; others only need to read and write existing tables. Review those needs before changing permissions.
Avoid global privileges, administrative accounts and a wildcard host as a shortcut. The GRANT reference distinguishes database and table scopes. Test the plugin's normal operations after narrowing grants so a missing permission does not surface during a busy session.
Verify encryption in the actual client
Use a VPN or properly configured TLS for traffic between machines. Check the plugin's JDBC driver and its supported TLS settings. MariaDB documents server and client encryption, but defaults depend on versions and client support. Do not assume a successful login proves certificate validation.
When a MariaDB client session connects, inspect its connection status and cipher information. Repeat the check with the application configuration, and keep secrets out of screenshots. Requiring encryption on the account can help enforce the intended policy once client compatibility has been verified.
Return to the plugin with one known-good path
After a client can connect from the game environment, compare the plugin's endpoint, database and credentials with that test. Look for stale configuration files, duplicate connection settings and an old hostname. Restart only the service that needs the change, within a maintenance window.
Watch for successful queries and repeat failures. Record the source allowlist so a future node move includes a database-access update. Use our VPS monitoring checks for the database host, and follow the maintenance checklist when changing listeners or firewall rules.


