#Error: connect ECONNREFUSED 127.0.0.1:3306 - For FiveM

39 messages · Page 1 of 1 (latest)

earnest canopy
#

Hello, I've try many things since many days but I still have this error when I started my FiveM server.
[ script:oxmysql] Error: Unable to establish a connection to the database! [ script:oxmysql] [Error: connect ECONNREFUSED 127.0.0.1:3306]

My user have the grant option (cf 2 screen), I've follow this steps : https://pterodactyl.io/tutorials/mysql_setup.html

I'm using this connection string : mysql://u3_3cNbs8URPd:PASSWORD@127.0.0.1:3306/DB-TABLE-NAME

I've already have this error a years ago and I can't remember what I've done.

For information, I've a dedicated server on Debian 11 with nginx.

Thanks in advance

crisp capeBOT
earnest canopy
#

When I'm changing the Ip adresse on the database management i get this error There was an error while trying to connect to the host or while executing a query: "SQLSTATE[HY000] [1045] Access denied for user 'pterodactyluser'@'ns3052703.ip-137-74-95.eu' (using password: YES) (SQL: SELECT 1 FROM dual)"

crisp capeBOT
#

🇫🇷 🥖 Bienvenue sur Internet, @earnest canopy 🥖 🇫🇷

Your database is refusing the Panel's attempts to connect to it. This can be for a number of different reasons so I'll let a human double check, but here are some ideas.

  1. Is your MySQL instance running? systemctl status mysql(hopefully not down the road)
  2. Is the user you're trying to connect with authorized to access the given database from this IP address?
  3. Did you correctly give that user permission to even access that database?
  4. Do you have a Firewall that is blocking connections?
  5. Is your MySQL instance bound to 127.0.0.1 or localhost and you're trying to connect from outside the server?
  6. Does the user have GRANT permissions if you're trying to use them to create a new database for a server?
  7. Have special characters in your password? Make sure DB_PASSWORD in your .env file is enclosed in double quotes

Here is some additional documentation to help you out: https://pterodactyl.io/tutorials/mysql_setup.html

earnest canopy
#
  1. My server is running
  2. Yes, I've authorize all type of IP :
    Here are some lines of my /etc/mysql/my.cnf
    [mysqld] bind-address=0.0.0.0
  3. The user was created by the panel itself
  4. I've any firewall and I've only one dedicated server
  5. I'Like said in the second point, my mariadb server is bind to 0.0.0.0
  6. Like said in my initial message, the user who have created this user have grant option. The user created have this grants :
#

||MariaDB [(none)]> show grants for 'u3_3cNbs8URPd'@'%'; +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Grants for u3_3cNbs8URPd@% | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO u3_3cNbs8URPd@%IDENTIFIED BY PASSWORD '*2357968D2AFEE3B457E6E82AE41EDA92A863DA2F' | | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ONs3_dev-env-our-tales.* TO u3_3cNbs8URPd@% | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.000 sec) ||
7. My password have no special characters.

For information I've tried to change the DB_HOST in my .env by 172.18.0.1 and I got a 500 error on the panel.

I've already follow the steps of your documentation

woven pagoda
#

nothing in your env file is relevant to your game server accessing mysql

crisp capeBOT
#

The env file can be found at /var/www/pterodactyl/.env. Files starting with a . in Linux are hidden so it may not show up in file browsers by default. You can open it directly with nano /var/www/pterodactyl/.env

woven pagoda
#

You have configured your game server to look for the database server at 127.0.0.1, but that refers to the container. You need to configure your game server to connect to the database at the nodes public IP, or docker interface address.

earnest canopy
#

Thanks Danny for your answer. I've try to apply this to the Databases admin panel in "Management". But when I tried to setup the database with the IP of my public IP or my docker IP (172.17.0.1 or 172.18.0.1) I get this error :
There was an error while trying to connect to the host or while executing a query: "SQLSTATE[HY000] [1130] Host 'ns3052703.ip-137-74-95.eu' is not allowed to connect to this MariaDB server (SQL: SELECT 1 FROM dual)"

crisp capeBOT
woven pagoda
#

You don't apply it in the database management page, You need to apply it in your game servers configuration files

earnest canopy
#

There ?

#

Because I've done this (cf screen attached). And now I got this error : [ script:oxmysql] Error: Unable to establish a connection to the database! [ script:oxmysql] [Error: Host '172.18.0.2' is not allowed to connect to this MariaDB server]
But in my in my.cnf I've bind the server to all type of adresses : [mysqld] bind-address=0.0.0.0

woven pagoda
woven pagoda
earnest canopy
#

Ok, but I don't see where I can set the settings your speaking about :/
Because in my last screen the host seems to be define from the database management page

earnest canopy
woven pagoda
#

Leave the bind-address as 0.0.0.0

woven pagoda
#

and since you've now configured your game server properly, it will work after that.

earnest canopy
#

If I do that I'm back at my initial situation.
I understand I need to change endpoint (screen 1) but It seems to take this string directly from the database management settings (screen 2)

woven pagoda
#

The gameserver doesn't pull anything from the panel

#

You don't need to change the endpoint in the panel

earnest canopy
#

I understand what your saying but I've try so many things and that still not work. I've also try with the root (for testing meaning) account and that don't work. I got this message : [ script:oxmysql] Error: Unable to establish a connection to the database! [ script:oxmysql] [Error: Access denied for user 'root'@'172.18.0.2' (using password: YES)]

crisp capeBOT
#

Please explain the issue you're experiencing in as much detail as possible. Preferably with error messages in a text format or paste link to logs. Nobody can assist you without information that helps to understand the issue. Help us help you. Messages such as "doesn't work" or "i need help" will most likely be ignored.

woven pagoda
earnest canopy
#

Even with the correct account that don't work ..

crisp capeBOT
#

Please explain the issue you're experiencing in as much detail as possible. Preferably with error messages in a text format or paste link to logs. Nobody can assist you without information that helps to understand the issue. Help us help you. Messages such as "doesn't work" or "i need help" will most likely be ignored.

woven pagoda
#

Use the correct account, then show the error message

earnest canopy
#

The same one :
[ script:oxmysql] Error: Unable to establish a connection to the database! [ script:oxmysql] [Error: Access denied for user 'u3_LavAp9BLSH'@'172.18.0.2' (using password: YES)]

woven pagoda
#

So not "back at my initial situation" at all

#

is the CONNECTIONS FROM for that account set to % ?

earnest canopy
#

Yes

woven pagoda
#

Then your password is wrong.

#

If there are special characters in the password, you might need to run them though a urlencode

earnest canopy
#

like this one ?https://www.w3schools.com/tags/ref_urlencode.ASP

If yes I still get the same error :
[Error: Access denied for user 'u3_LavAp9BLSH'@'172.18.0.2' (using password: YES)]