Finally: This is the ultimate fix if your FiveM Server, can't connect to database because of Pterodactyl

You get this error?:

[script:mysql-async] [mysql-async] [ERROR] connect ECONNREFUSED 127.0.0.1:3306

I finally figured it out: namely when you use Pterodactyl and use “localhost” or “127.0.0.1”, you call the container itself.

Very simple fix:
enter the following command in your SSH console:
ip addr | grep docker0

Then you should get something like this:

docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOW                                                           
N group default
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0

and exactly this IP address 172.17.0.1 you use as your MySQL server. If you still get an error you should bind your MySql server to get the connections from outside, this you do as follows:

1. find /etc -iname my.cnf
2. nano /etc/mysql/my.cnf
3. at the bottom add this  

[mysqld]
bind-address=0.0.0.0

now you are ready and your FiveM server connects to the database! :grin:

1 Like

Hi, I followed what you wrote and it seems to work but I have another error I think I made a mistake somewhere, please help me, the error is :
cfx> [ script:mysql-async] [mysql-async] [ERROR] ER_ACCESS_DENIED_ERROR: Access denied for user ‘u1_yWdBPD6beO’@‘172.18.0.2’ (using password: YES)

(sorry if my English is bad, I am French)

Thank you for your reply.

This error is caused when the password of your database user is wrong. Either you change the password yourself or you tell your hoster :slight_smile:

I will try to change my password, if I still have an error I can come to you? :grinning:

Sure!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.