#Trying to setup shared databases

17 messages · Page 1 of 1 (latest)

nocturne pebble
#

Yesterday, I installed and set up Pterodactyl and created several servers. Since I already had configured servers beforehand, I deleted all the files in the created servers and replaced them with my existing ones. I also created new databases and updated the configurations (directly in the database table) to use the existing ones.

The issue I am facing is that neither the proxy (Velocity) nor the Paper servers can access the databases. For each plugin that tries to connect, I receive the following error:

Could not create connection to database server. Attempted reconnect 3 times. Giving up.

Here is an example of my configuration for database access:

  address: localhost:3306
  database: removed
  username: removed
  password: 'removed'

What I have tried so far:

  1. Verified that the database credentials (username, password, database name) are correct by successfully connecting to the database using the mariadb command from the terminal on the host machine.
  • Command used: mysql -u <username> -p -h 127.0.0.1 -P 3306
  1. Tested different values for address, including:
  • localhost
  • 127.0.0.1
  • The server's public IP address
  • host.docker.internal
  1. Updated the MariaDB configuration to allow connections from any IP address by setting bind-address = 0.0.0.0 in /etc/mysql/mariadb.conf.d/50-server.cnf and restarted the MariaDB service.
  2. Verified the firewall configuration:
  • Ensured the firewall was initially disabled and later explicitly allowed traffic from the Docker subnet (172.17.0.0/16) to port 3306.

Despite these efforts, the issue remains unresolved. Any guidance or suggestions would be greatly appreciated.

remote yachtBOT
#

If your server cannot see the database, please make sure your mod/plugin is connecting to pterodactyl0 interface 172.18.0.1 or the public IP to reach the local database. You can not use localhost or 127.0.0.1 as that would be the container itself.

You also have to configure the database bind-address to listen on all interfaces following the guide below.
https://pterodactyl.io/tutorials/mysql_setup.html#creating-a-database-host-for-nodes

novel hornet
#

And you'd want to allow from the Pterodactyl0 subnet in your firewall. There's an example in the Minecraft guide; just use 3306 for the local port.

remote yachtBOT
nocturne pebble
# novel hornet And you'd want to allow from the Pterodactyl0 subnet in your firewall. There's a...

Bind address was already set and even with 172.18.0.1 it still doesnt work but now im getting Access denied for user 'minecraft_playtime'@'172.18.0.2' (using password: YES). When executing mysql -u minecraft_perms -p -h 172.18.0.1
and then entering the password from the config i can login but the proxy cant access it.

This is my ufw status:
Status: active

To Action From


25565/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443 ALLOW Anywhere
22/tcp ALLOW Anywhere
21/tcp ALLOW Anywhere
8804 ALLOW Anywhere
19132 ALLOW Anywhere
8080 ALLOW Anywhere
2022 ALLOW Anywhere
3306 ALLOW 172.17.0.0/16
3306 ALLOW Anywhere
3306 ALLOW 172.18.0.0/16
172.18.0.1 3306/tcp on pterodactyl0 ALLOW Anywhere
25565/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
21/tcp (v6) ALLOW Anywhere (v6)
8804 (v6) ALLOW Anywhere (v6)
19132 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
2022 (v6) ALLOW Anywhere (v6)
3306 (v6) ALLOW Anywhere (v6)

novel hornet
#

What did you put for "Connections From"?

nocturne pebble
modern magnet
#

When you created the database, there is a "connections from" field that sets where connections are allowed from. What did you set it to ?

nocturne pebble
novel hornet
nocturne pebble
# novel hornet What do you see in MariaDB's logs since the last start?

Hey, this issue was just resolved. I just got home and checked the hostname and saw that i had duplicated the users with a wrong hostname, and after deleting the duplicates i could access the database. Thanks for your help though.

Now i have the issue that i cant access to the lobby server ( Connection refused: /172.18.0.1:40001 Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused )

my velocity config:

[servers]
# Configure your servers here. Each key represents the server's name, and the value
# represents the IP address of the server to connect to.
Lobby = "172.18.0.1:40001"

What else am i doing wrong 😕

#

see, even support bot is bullying me haha

novel hornet
remote yachtBOT
nocturne pebble
nocturne pebble
#

Ok i tried again with the public ip and it worked. thanks everyone for your time

tepid oar
#

Hi @nocturne pebble, I have the same problem as you but I didn't understand how you solved it, can you explain to me?

java.sql.SQLException: Access denied for user 'u1_4cjciCsqL9'@'172.18.0.2' (using password: YES)