Traccar cannot connect with mysql

Amadoa year ago

Hello!!!!
I installed traccar 6.6 on a new vps with ubuntu 22.04 and mysql 8.0.40
I copied and existing traccar.xml config file from a working traccar 6.4 server (with mysql)
Traccar 6.6 fails at start up and the log file shows the error " Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl"
What can be wrong?

Anton Tananaeva year ago

Logs please.

Anton Tananaeva year ago

And also provide your config, at least the database part.

Amadoa year ago

traccar.xml configuration:

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://localhost:3306/traccar?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'>xxxx</entry>
<entry key='database.password'>xxxx</entry>

Log errors:

2025-01-16 14:35:42  INFO: Version: 6.6
2025-01-16 14:35:42  INFO: Starting server...
2025-01-16 14:35:42  INFO: HikariPool-1 - Starting...
2025-01-16 14:35:43 ERROR: Main method error - Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl, jdbc:mysql
://localhost:3306/traccar?zeroDateTimeBehavior=round&serverTimezone=
UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode
=yes&characterEncoding=UTF-8&sessionVariables=sql_mode='' - RuntimeException (... < DatabaseModule:80 < <gener:-1 < *:
-1 < ... < MainModule:138 < <gener:-1 < ...)
Anton Tananaeva year ago

Why do you have a bunch of line breaks there?

Amadoa year ago

Just to visualize all the text in one screen. Besides, it is easier to copy/paste in this way

Amadoa year ago

What do you think? Should I try with an earlier version of traccar or mysql?

Anton Tananaeva year ago

Line breaks probably made it invalid, so you should fix that.

Amadoa year ago

Yessss, that fixes the problem. Thank you Anton!!!!