LuckPerms

LuckPerms

41.4k Downloads

Luckperms cannot connect to MySQL in Pterodactyl

vaio2005 opened this issue ยท 10 comments

commented

After creating a database MySQL in pterodactyl and putting the information in the configuration file, the plugin gives a timeout error
[14:10:29 ERROR] [LuckPerms]: Failed to init storage implementation [14:10:29 ERROR]: java.sql.SQLTransientConnectionException: luckperms-hikari - Connection is not available, request timed out after 5000ms. [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:695) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool.getConnection(HikariPool.java:197) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool.getConnection(HikariPool.java:162) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.HikariDataSource.getConnection(HikariDataSource.java:100) [14:10:29 ERROR]: at me.lucko.luckperms.common.storage.implementation.sql.connection.hikari.HikariConnectionFactory.getConnection(HikariConnectionFactory.java:151) [14:10:29 ERROR]: at me.lucko.luckperms.common.storage.implementation.sql.SqlStorage.init(SqlStorage.java:155) [14:10:29 ERROR]: at me.lucko.luckperms.common.storage.Storage.init(Storage.java:115) [14:10:29 ERROR]: at me.lucko.luckperms.common.storage.StorageFactory.getInstance(StorageFactory.java:88) [14:10:29 ERROR]: at me.lucko.luckperms.common.plugin.AbstractLuckPermsPlugin.enable(AbstractLuckPermsPlugin.java:151) [14:10:29 ERROR]: at me.lucko.luckperms.bungee.LPBungeeBootstrap.onEnable(LPBungeeBootstrap.java:153) [14:10:29 ERROR]: at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:300) [14:10:29 ERROR]: at net.md_5.bungee.BungeeCord.start(BungeeCord.java:289) [14:10:29 ERROR]: at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62) [14:10:29 ERROR]: at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15) [14:10:29 ERROR]: Caused by: me.lucko.luckperms.lib.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure [14:10:29 ERROR]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [14:10:29 ERROR]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [14:10:29 ERROR]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [14:10:29 ERROR]: at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.Util.handleNewInstance(Util.java:425) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:335) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2187) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) [14:10:29 ERROR]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [14:10:29 ERROR]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [14:10:29 ERROR]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [14:10:29 ERROR]: at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.Util.handleNewInstance(Util.java:425) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:428) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:136) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.PoolBase.newConnection(PoolBase.java:358) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool.access$100(HikariPool.java:71) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:725) [14:10:29 ERROR]: at me.lucko.luckperms.lib.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:711) [14:10:29 ERROR]: at java.util.concurrent.FutureTask.run(FutureTask.java:266) [14:10:29 ERROR]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [14:10:29 ERROR]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [14:10:29 ERROR]: at java.lang.Thread.run(Thread.java:748) [14:10:29 ERROR]: Caused by: java.net.ConnectException: Connection refused (Connection refused) [14:10:29 ERROR]: at java.net.PlainSocketImpl.socketConnect(Native Method) [14:10:29 ERROR]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) [14:10:29 ERROR]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) [14:10:29 ERROR]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) [14:10:29 ERROR]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) [14:10:29 ERROR]: at java.net.Socket.connect(Socket.java:607) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211) [14:10:29 ERROR]: at me.lucko.luckperms.lib.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:299) [14:10:29 ERROR]: ... 24 more
The MySQL is working fine, and nothing should create that error. What can I do?
This is the config for the storage.
storage-method: mysql

data:

address: 127.0.0.1

database: NAME. IS CORRECT.

username: USER. IS CORRECT
password: 'PASSWORD. IS CORRECT'

commented

From the look of it, you get 'Connection refused'
I would make sure that there is no iptables or so in the way.

What you can try is this:
'mysql -h 127.0.0.1' on the command-line and see if you get the same results.
Because if you are using only mysql, it will connect by default using the socket, not tcp.

commented

I did that command, and the result was a Error 28000: Access denied for user 'root'@'localhost' (it's a password issue)
So I think that the database is working. It's MySQL, not any variant like MariaDB or mongoDB.
Any other tips?

commented

You probably need to use the Docker IP address @vaio2005 . I believe this is usually 172.18.0.1

Confirm with docker ps
image

commented

Sorry for close and reopen, using phone is kinda bad. MySQL is not in docker.it is in the host system.
I don't know precisely how ptero works, so I guess my mc servers are using docker.

commented

Well, This is not a Luckperms issue then I guess.
You need to figure out how the networking works if you are running docker.
Do you run MySQL in docker as well? Then take a look at docker networking and read up on that.
Addressing in docker using IP is a bad thing, because it might be random.
Dockers internal DNS is better for that.

commented

Pterodactyl is a constant issue for people because they don't understand how it works, so here is a sum up

  1. Pterodactyl uses docker form gameservers, that allows it to easily create and destroy gameservers without complicated setups
  2. If you want to use MySQL in Pterodactyl, you cannot use 127.0.0.1, because each gameserver has its own internal IP adress and is not directly connected to the system. You can either use 172.18.0.1 ( default IP when using Pterodactyl ) or 172.17.0.1 ( always works since its the default docker host IP )
  3. The database has to be configured to accept connections from outside 127.0.0.1, otherwise you won't be able to connect since the database isn't listening to that IP. So go into the /etc/mysql folder, find the variable bind-address and change its value to 0.0.0.0
  4. The database user has to be created as USERNAME@'%' Pterodactyl should do this by default if you create databases trough it, so that shouldn't be a issue for you to worry about
commented

Not 127, its 172. 172.18.0.1 not 127.18.0.1

commented

I tried using luckperms with MySQL on 127.17.0.1 and 127.18.0.1, each of them gave a connection issue. The database bind address is * (with /usr/sbin/mysqld --help --verbose). Am I missing something?

commented

(I set it to 0.0.0.0 just to test, and still is not working)