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