MySQL Database

By default Traccar uses an embedded H2 database, but we don't recommend for it for production. If you want to use another SQL database instead, you can replace the following lines in the configuration file:

<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:./data/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 a local database use localhost as HOST):

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://[HOST]/[DATABASE]?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>
Traccar will create tables for you, but not the database. Make sure you use the InnoDB engine for the database. Traccar uses foreign key constraints, which is not supported by MyISAM engine.

We also recommend checking our MySQL optimization guide.

If you are using an older version of Traccar, you might need to use the old database driver:

<entry key='database.driver'>com.mysql.jdbc.Driver</entry>