MYSQL database configuration

Jean-François6 years ago

Hi everybody,

Thank you Anton for you Traccar Project and all the time you spend on it.

I installed Traccar on a VPS from OVH. Everything is ok, and it work perfectly, even after HTTPS configuration.

Now, I'm trying to configure MySQL database. I've installed mysql-server, created a limited user for traccar database, and the database traccar.

I've also changed the traccar.xml as follow :

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <entry key='config.default'>./conf/default.xml</entry>
    <entry key='web.port'>8082</entry>
   
<!--    <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='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost:3306/traccar?useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>traccar</entry>
    <entry key='database.password'>mypassword</entry>

</properties>

When I start traccar daemon there no error.
But when I try to go to my website I get a 503 error :

Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

When I come back to H2 database configuration and restart the daemon, everything is OK.

Does somebody have an idea to solve this problem?

Thank you

Anton Tananaev6 years ago

Have you checked logs?

Jean-François6 years ago

I looked at the logs but no error visible.

BUT, without any changes now it works ... I don't know why.

But, when I try to connect I can't. I think it's because the traccar users where defined in the H2 database, right?

I have to create an admin user in the traccar database ?

Anton Tananaev6 years ago

Traccar automatically creates admin user.

Jean-François6 years ago

ohhhhh. I've tryied with my admin password, but not with the original password. :(

Thank you Anton.

I will try to find the explanation why the mysql configuration didn't work at the beginning...

vinay sharma6 years ago

I also have created local database with name of traccardemo but how table would be come in database ?

Jean-François6 years ago

Hi,

Traccar will create the tables. You have to change the traccar.xml. After that, traccar will work with your mysql database instead of the H2 database.

vinay sharma6 years ago

Thanks Jean for reply for this great opensource application.... Exe file of Traccar is working but still without showing the GPS point of android mobile location on web localhost. And also, Do you know that how configure source code of Traccar?

Jean-François6 years ago

For your first problem there can be many reasons:

  • bad client configuration
  • firewall on your server and the 5055 port is locked
  • bad configuration in traccar interface (device Id)

You have to look at the log file on your server.

For the second point, what do you want to configure in the source code? And witch one, client or server?