MySQL and Self-hosted Traccar

UTDT 4 months ago

I don't seem to be able to get the traccar server to run locally on self-hosted mysql DB.
I have followed the instruction on this page "https://www.traccar.org/mysql/" and literally copy&pasted the code lines for MySQL (below):

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://localhost/livetracking?zeroDateTimeBehavior=round&amp;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'>root</entry>
<entry key='database.password'>abcd1234</entry>

On checking the logs file i have this error:

2025-09-10 12:16:39  INFO: Operating system name: Linux version: 6.10.4 architecture: amd64
2025-09-10 12:16:39  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: AlienBOB Slackware version: 17.0.15+6
2025-09-10 12:16:39  INFO: Memory limit heap: 950mb non-heap: 0mb
2025-09-10 12:16:39  INFO: Character encoding: UTF-8
2025-09-10 12:16:39  INFO: Version: 6.9.1
2025-09-10 12:16:39  INFO: Starting server...
2025-09-10 12:16:39  INFO: HikariPool-1 - Starting...
2025-09-10 12:16:44 ERROR: Main method error - Connection refused - ConnectException (... < DatabaseModule:80 < <gener:-1 < *:-1 < ... < MainModule:139 < <gener:-1 < ...)

Could anyone tell me if/how they have managed to get the self-hosted server to connect to MySQL?

Anton Tananaev 4 months ago

If your MySQL listening for network connections?

UTDT 4 months ago

Thanks again Anton.
No. I just realized that mysql is not listening network connections. Grrr
I will report back!

UTDT 4 months ago

Thanks Anton,

Finally, i managed to get the server running on local MySQL.

However, i dont seems to be able to see a Traccar Client app (on my phone), as online.

On the client app i am using as a 'url' my IPv4 address (followed by port:5055)

On investigating within my router, and after enabling port forwarding '5055' i still can't test the tracking (and now it's intersting, as I have no logs to refer to). Now, the public IP address goes to a TV router (kinda NAT fireblock) which returns a local '192.168.0.xx' address.

Is there a way to go around the URL/IP issue?

Anton Tananaev 4 months ago

I'm not sure I understand what the issue is.

UTDT 4 months ago

I think, the issue is that the server is not seeing the Traccar Client app (in my phne).

On the 'demo server' I add a device, set the Device identifier and, after a few seconds, i can see the added device going 'green' (online).

On the local sever it stays offline. And, I believe it is because i choose the wrong 'url' on the traccar Client app. (i have tried the public IP address 92.251.xx.xxx:5055, I have tried the NAT address given by the TV-router 192.168.x.xx:5055 and i have tried 127.0.0.1:5055)

Nothng seems to get my device to communicate with the server.

p.s.: i am wondering whether it would any easier with portable gps devices with an IMEI no., etc...

UTDT 4 months ago

by the way, (just as feedback), the client app keeps on crashng everytime i change the 'url' and there is nothing i can do to get it back to life except from uninstalling and reinstalling the app

Anton Tananaev 4 months ago

What exactly are you entering as the URL?

UTDT 4 months ago
http://92.252.xx.xxx;5055
Anton Tananaev 4 months ago

That's not a valid URL.

UTDT 4 months ago

mistype: after the ip address there is a colon ':'

Anton Tananaev 4 months ago

And have you tested if this IP and port are accessible from external networks?