partiusfabaa / cs2-ranks

49 stars 19 forks source link

Plugin can't connect to database #20

Open lostsoul6 opened 8 months ago

lostsoul6 commented 8 months ago

Hello ,

I'm using mysql on non-default port . I'm using port 5851 . When I run the server , I get these errors :

MySqlConnector.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
   at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, MySqlConnection connection, Int32 startTickCount, ILoadBalancer loadBalancer, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 449
   at MySqlConnector.Core.ConnectionPool.ConnectSessionAsync(MySqlConnection connection, Action`4 logMessage, Int32 startTickCount, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 409
   at MySqlConnector.Core.ConnectionPool.ConnectSessionAsync(MySqlConnection connection, Action`4 logMessage, Int32 startTickCount, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 414
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 106
   at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int32 startTickCount, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ConnectionPool.cs:line 135
   at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Activity activity, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 916
   at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 425
   at MySqlConnector.MySqlConnection.Open() in /_/src/MySqlConnector/MySqlConnection.cs:line 387
   at Ranks.Ranks.CreateTable()
   at Ranks.Ranks.CreateTable()

Here is my config :

"Connection": {
    "Host": "localhost:5851",
    "Database": "data4p",
    "User": "cs2p",
    "Password": "password"
  }

I have tried using the following instead of localhost:5851 :

localhost 127.0.0.1 server-ip

localhost:5851 127.0.0.1:5851 server-ip:5851

none of the above works . I'm sure database , user and password are correct . I tested them and they are all available with mysql commands . Can you please help me find the problem?

Kind Regards ,

lostsoul6 commented 8 months ago

update :

I changed the mysql port to the default 3306 and the connection is OK and plugin is working , however , I don't want to use the default port . How do we set a non-default port in config file like 5851?

partiusfabaa commented 8 months ago

for now, you cant put your port. In the next update, i'll add

lostsoul6 commented 8 months ago

Thank you , I will keep watching for the new update then .

partiusfabaa commented 8 months ago

https://github.com/partiusfabaa/cs2-ranks/releases

Lediak commented 8 months ago

I'm sorry but where do you put your config to connect at ur database ? I didnt see the folder ...