Having issues with MySQL databases in Pterodactyl.

I bought a dedicated server from PebbleHost and I'm making databases to connect my plugins to however none of the plugins will connect despite trying all different combinations of hosts and such. I'm almost certain everything is right. I was checking the database.php in Pterodactyl and saw this
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/

'connections' => [
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'panel'),
'username' => env('DB_USERNAME', 'pterodactyl'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'strict' => env('DB_STRICT_MODE', false),
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))),
'sslmode' => env('DB_SSLMODE', 'prefer'),
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
PDO::MYSQL_ATTR_SSL_CERT => env('MYSQL_ATTR_SSL_CERT'),
PDO::MYSQL_ATTR_SSL_KEY => env('MYSQL_ATTR_SSL_KEY'),
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
]) : [],
],
],
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/

'connections' => [
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'panel'),
'username' => env('DB_USERNAME', 'pterodactyl'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'strict' => env('DB_STRICT_MODE', false),
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))),
'sslmode' => env('DB_SSLMODE', 'prefer'),
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
PDO::MYSQL_ATTR_SSL_CERT => env('MYSQL_ATTR_SSL_CERT'),
PDO::MYSQL_ATTR_SSL_KEY => env('MYSQL_ATTR_SSL_KEY'),
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
]) : [],
],
],
Should this not be filled in?
32 Replies
Admincraft Meta
Admincraft Meta6mo ago
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by nunyabizbro#0
Torrent
Torrent6mo ago
Did you follow this guide?
DrewIT
DrewITOP6mo ago
I did not, it's a pre-installed OS image from PebbleHost
SilentBot
SilentBot6mo ago
No, env(... pulls from environment variables, which can typically be found in the file /var/www/pterodactyl/.env
SilentBot
SilentBot6mo ago
You shouldn't also be using these credentials for plugins / apps either, you should be using the panel to create a new database from the admin side of things, e.g.
No description
SilentBot
SilentBot6mo ago
You can then go back to the server once it has been created, and access the credentials you should be using by clicking the eye on the right:
No description
DrewIT
DrewITOP6mo ago
Yeah I've been trying those however they're not working.
DrewIT
DrewITOP6mo ago
No description
DrewIT
DrewITOP6mo ago
I've tried allowing all connections, changing passwords etc.
SilentBot
SilentBot6mo ago
So for the top one, you're clicking the eye, copying the IP address/port + username&password it gives you, and you're using this in the plugin? The 2nd one likely won't work, as your game server isn't at 127.0.0.1 due to docker
DrewIT
DrewITOP6mo ago
Correct. I've also tried putting the host in the plugin file 0.0.0.0, localhost, the actual ip to my server and 127.0.0.1 Let me make a dummy database and try to connect it, I'll show you what happens.
SilentBot
SilentBot6mo ago
And just to sanity check, do those four things you've mentioned include the IP given from when you've clicked the eye? (I assume it's just your external IP, so yes?)
DrewIT
DrewITOP6mo ago
Correct. So here are the settings
DrewIT
DrewITOP6mo ago
No description
DrewIT
DrewITOP6mo ago
No description
DrewIT
DrewITOP6mo ago
I have the mysql-host set to my external ip. Save config and restarting, I'll screenshot the error.
SilentBot
SilentBot6mo ago
👍 I assume it's probably going to be the firewall
DrewIT
DrewITOP6mo ago
This happens on multiple different plugins too despite how I configure it so I don't think it's plugin-sided.
DrewIT
DrewITOP6mo ago
No description
DrewIT
DrewITOP6mo ago
This is for CoreProtect, but all plugins give a similar error.
DrewIT
DrewITOP6mo ago
No description
DrewIT
DrewITOP6mo ago
oops hangon
SilentBot
SilentBot6mo ago
So, access denied means that the database responded, but the user doesn't have the right perms Are you sure the port is 3306?
DrewIT
DrewITOP6mo ago
Forgot to change the database name, one secon.
mysql-database: s1_dummy
mysql-username: u1_5sYxMWFPdh
mysql-password: H0pYRVoYypO1i=MeZ=MLAgTE
mysql-database: s1_dummy
mysql-username: u1_5sYxMWFPdh
mysql-password: H0pYRVoYypO1i=MeZ=MLAgTE
These are now the correct settings, let me restart
SilentBot
SilentBot6mo ago
👌
DrewIT
DrewITOP6mo ago
so. Please don't make fun of me, I have no clue what I did but they're working now.
SilentBot
SilentBot6mo ago
That's what I like to hear 😄
DrewIT
DrewITOP6mo ago
I SWEAR I had the right info in there. I've been messing with this for hours.
SilentBot
SilentBot6mo ago
It's all good, as long as it now works for you 🙂
DrewIT
DrewITOP6mo ago
Thanks for the help! 🙂
SilentBot
SilentBot6mo ago
Any time
Admincraft Meta
Admincraft Meta6mo ago
post closed!
The post/thread has been closed!
Requested by nunyabizbro#0

Did you find this page helpful?