Traccer gprs is by default available with H2 database
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
<!-- Documentation: https://www.traccar.org/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>
<entry key='openid.clientId'>7</entry>
<entry key='web.url'>https://traccar.motoshare.in</entry>
<entry key='openid.force'>true</entry>
<entry key='openid.clientSecret'>mBFTte6s64MRCrhs5N3Sd36Ch1POoPFXxDUgevXG</entry>
<entry key='openid.issuerUrl'>https://demo.motoshare.in</entry>
<entry key='openid.authUrl'>https://demo.motoshare.in/oauth/authorize</entry>
<entry key='openid.tokenUrl'>https://demo.motoshare.in/oauth/token</entry>
<entry key='openid.userInfoUrl'>https://demo.motoshare.in/api/user</entry>
<entry key='logger.level'>all</entry>
</properties>
Enter maria db or MySQL shell
mysql -u root -p
enter password: rakesh@123 then again enter password is available in Laravel project env
create database
CREATE DATABASE traccar CHARACTER SET utf8 COLLATE utf8_bin;
Change configuration in configuration file
/opt/traccar/conf/traccar.xml
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>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=''</entry>
<entry key='database.user'>root</entry>
Restart traccar
sudo systemctl restart traccar
sudo systemctl status traccar
output of sudo systemctl restart traccar
Loaded: loaded (/etc/systemd/system/traccar.service; enabled; preset: enabled)
Active: active (running) since Thu 2025-08-07 08:40:29 UTC; 8s ago
Main PID: 349954 (java)
Tasks: 27 (limit: 4600)
Memory: 213.9M (peak: 214.3M)
CPU: 16.408s
CGroup: /system.slice/traccar.service
note: it must be active
now add device from software
output
Trouble shoot
Error 500 or connection timed out
click track vehicle 2 or more times continous try
because of memory or slowness issue
go to logs directory
/opt/traccar/logs
vi tracker-server.log
Invalid XML in traccar.xml
Invalid XML in traccar.xml
Even a small typo, incorrectly escaped special characters (like & in your JDBC URL), or invalid XML structure will cause status=1 failures.
Tip: Run this to check for errors:
xmllint conf/traccar.xml
Fix any XML errors.
Special Characters in Password or URL
If your MySQL password or JDBC URL contains special characters, make sure they are valid within the XML and JDBC context. For instance, use & instead of & inside XML attributes, especially in your JDBC URL.
Example:
<entry key='database.url'>jdbc:mysql://localhost:3306/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true...</entry>
mysql -u traccar -p -h localhost -P 3306
enter password // in env file check
where traccar is database name
after run password u entered in maria db
To use MySQL successfully you must:
Log in as root in MySQL and run the following:
CREATE USER 'traccar'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON traccar.* TO 'traccar'@'localhost';
FLUSH PRIVILEGES;
Traccar is listening but you still get 503: Make sure Apache ProxyPass is correct and there are no local network blocks
error: when i run below command
sudo systemctl restart traccar
ERROR: Main method error - Database is in a locked state. It could be due to early service termination on a previous launch. To unlock you can run this query: 'UPDATE DATABASECHANGELOGLOCK SET locked = 0'. Make sure the schema is up to date before unlocking the database. - DatabaseLockException (DatabaseModule:102 < <gener:-1 < *:-1 < ... < MainModule:139 < <gener:-1 < ...)
.
Solution:
mysql -h localhost -u root -p
USE traccar;
UPDATE DATABASECHANGELOGLOCK SET locked = 0;
ctrl d
sudo systemctl restart traccar
Top comments (0)