Mysql configuration

Deborah4 months ago

Hi, I am having problems configuring mysql. Below i copy my configuration file.

The connection to the db and user from command line is done correctly. But when I try to start Traccar it gives this error. No logs are present

Cosa può essere?

sudo systemctl status traccar
● traccar.service - traccar
     Loaded: loaded (/etc/systemd/system/traccar.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-08-03 14:56:24 CEST; 3s ago
    Process: 2697 ExecStart=/opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml (code=exited, s>
   Main PID: 2697 (code=exited, status=1/FAILURE)
        CPU: 1.310s
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
    <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://192.168.0.161:3306/traccar2?zeroDateTimeBehavior=round&serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>traccar2</entry>
    <entry key='database.password'>xxxxxx</entry>
</properties>
Deborah4 months ago

I see that the xml is unreadable. I copied it here as well

https://pastecode.io/s/x9d0x16a

Anton Tananaev4 months ago

If no logs, it usually indicates that your XML is invalid. Remember that you have to escape some characters, like &, which I see you haven't done.

Deborah4 months ago

Thank you Anton, that was the problem.
I'll put the right line of code if anyone needs it

<entry key='database.url'>jdbc:mysql://192.168.0.161:3306/traccar2?zeroDateTimeBehavior=round&amp;serverTimezone=UTC&amp;allowPublicKeyRetrieval=true&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;charset=UTF-8&amp;sessionVariables=sql_mode=""</entry>
Anton Tananaev4 months ago

Is there a reason you didn't follow the official documentation?

https://www.traccar.org/mysql/

Deborah4 months ago

actually I had copied that line above from there, but in the documentation there are no escape characters given, at least it seems to me

Anton Tananaev4 months ago

Please provide a screenshot.

Deborah4 months ago

I can see them now.
Strange. They probably got lost in one of the copy and paste I did