MySQL Database

/MySQL Database
MySQL Database 2017-04-21T22:25:41+00:00

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.jdbc.Driver</entry> 
<entry key='database.url'>jdbc:mysql://[HOST]:3306/[DATABASE]?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>

NOTE: Traccar will create tables for you, but you need to create database with selected name by yourself. Make sure you use InnoDB engine for the database. Traccar uses constraints that are not supported by MyISAM engine.