MySQL Suddenly Refuses Connections

Chris H2 years ago

Hi
traccar and mysql running on same machine (windows server 2019) one day just started refusing connections after a windows update. Just want to rule out my configuration file here if someone can take a look please. I had this problem before and i think i just updated traccar & mysql it fixed the problem, maybe that was a coincidence I am not good a databases.

<entry key="database.driver">com.mysql.cj.jdbc.Driver</entry>
<entry key="database.url">jdbc:mysql://localhost:3306/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>

I get this error in traccar

2023-08-20 07:03:08 ERROR: HikariPool-1 - Exception during pool initialization. - Connection refused: no further information - ConnectException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
2023-08-20 07:03:08 ERROR: Main method error - Connection refused: no further information - ConnectException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
2023-08-20 07:03:08  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@4ebff610 threw the following exception - Connection refused: no further information - ConnectException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... <

I get this warning in MySql

2023-08-23T12:54:42.058436Z 9 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
Anton Tananaev2 years ago

Have you enabled network connections on the MySQL side?

Chris H2 years ago

I believe so, It was working before. Could it be because i'm using root? should i not use root? root is bound to localhost but looks like i'm using localhost in the traccar config so i should be good there right? I'm starting to think this is a driver issue because i have a bunch more warnings in MySQL

2023-08-23 10:47:45.902130, 14, [Warning] [MY-013360] [Server], Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
Anton Tananaev2 years ago

Are you using the latest Traccar? Make sure you use the official recommended configuration for MySQL URL.

Chris H2 years ago

Using version 5.8
From Traccar Recommended Document

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://[HOST]/[DATABASE]?zeroDateTimeBehavior=round&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
<entry key='database.user'>[USER]</entry>
<entry key='database.password'>[PASSWORD]</entry>

My Config File

<entry key="database.driver">com.mysql.cj.jdbc.Driver</entry>
<entry key="database.url">jdbc:mysql://localhost:3306/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
<entry key="database.user">root</entry>
<entry key="database.password">*****</entry>
Chris H2 years ago

I noticed my second line was a little different i changed it to match and still same problem.