Several years ago I successfully converted an older version of traccar server to use mysql, now I am working on a new installation on a new server and getting errors. The server stops and starts with the original /opt/traccar/conf/traccar.xml file, using systemctl stop traccar and systemctl start traccar
With my modified traccar.xml, it fails to start. Errors from log included here.
This is on CentOS 7 with mysql 5.5.68-MariaDB MariaDB Server
Instructions from: https://www.traccar.org/mysql/
By default Traccar Server uses embedded H2 database. If you want to use MySQL database engine you need to replace following lines in configuration file:
<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:/home/user/Documents/traccar/target/database</entry>
<entry key='database.user'>sa</entry>
<entry key='database.password'></entry>
Configuration parameters for MySQL (replace [HOST], [DATABASE], [USER], [PASSWORD] with appropriate values; for local database use "localhost" as HOST):
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://[HOST]:3306/[DATABASE]?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
<entry key='database.user'>[USER]</entry>
<entry key='database.password'>[PASSWORD]</entry>
My non-working /opt/traccar/traccar.conf file:
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql:localhost:3306/traccar?serverTimezone=UTC+8&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
<entry key='database.user'>USER</entry>
<entry key='database.password'>PASSWORD</entry>
netstat -tulpn | grep LISTEN | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 21251/mysqld
/opt/traccar/logs/tracker-server.log
2022-05-14 13:41:49 ERROR: Main method error - Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl, jdbc:mysql:localhost:3306/traccar?serverTimezone=UTC+8&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode='' - RuntimeException (... < DataManager:131 < *:90 < Context:298 < Main:120 < ...)
2022-05-14 13:42:00 INFO: HikariPool-1 - Starting...
2022-05-14 13:42:01 ERROR: Main method error - Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl, jdbc:mysql:localhost:3306/traccar?serverTimezone=UTC+8&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode='' - RuntimeException (... < DataManager:131 < *:90 < Context:298 < Main:120 < ...)
Did I miss something or is there possibly another issue?
Thanks, Mike
Several years ago I successfully converted an older version of traccar server to use mysql, now I am working on a new installation on a new server and getting errors. The server stops and starts with the original /opt/traccar/conf/traccar.xml file, using systemctl stop traccar and systemctl start traccar
With my modified traccar.xml, it fails to start. Errors from log included here.
This is on CentOS 7 with mysql 5.5.68-MariaDB MariaDB Server
Instructions from: https://www.traccar.org/mysql/
By default Traccar Server uses embedded H2 database. If you want to use MySQL database engine you need to replace following lines in configuration file:
<entry key='database.driver'>org.h2.Driver</entry> <entry key='database.url'>jdbc:h2:/home/user/Documents/traccar/target/database</entry> <entry key='database.user'>sa</entry> <entry key='database.password'></entry>
Configuration parameters for MySQL (replace [HOST], [DATABASE], [USER], [PASSWORD] with appropriate values; for local database use "localhost" as HOST):
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry> <entry key='database.url'>jdbc:mysql://[HOST]:3306/[DATABASE]?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry> <entry key='database.user'>[USER]</entry> <entry key='database.password'>[PASSWORD]</entry>
My non-working /opt/traccar/traccar.conf file:
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry> <entry key='database.url'>jdbc:mysql:localhost:3306/traccar?serverTimezone=UTC+8&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry> <entry key='database.user'>USER</entry> <entry key='database.password'>PASSWORD</entry>
/opt/traccar/logs/tracker-server.log
Did I miss something or is there possibly another issue?
Thanks, Mike