MYSQL

Mohamed3 years ago

Hello,
I have connected to mySQL server and created a new database with new user and gave all privileges to the user it give me this:

2021-02-07 04:12:42  INFO: HikariPool-1 - Starting...
2021-02-07 04:12:50 ERROR: HikariPool-1 - Exception during pool initialization. - Could not create connection to database server. Attempted reconnect 3 times. Giving up. - SQLNonTransientConnectionException (... < DataManager:139 < *:89 < Context:299 < Main:137 < ...)
2021-02-07 04:12:50 ERROR: Main method error - Could not create connection to database server. Attempted reconnect 3 times. Giving up. - SQLNonTransientConnectionException (... < DataManager:139 < *:89 < Context:299 < Main:137 < ...)
2021-02-07 04:12:50  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@3e78b6a5 threw the following exception - Could not create connection to database server. Attempted reconnect 3 times. Giving up. - SQLNonTransientConnectionException (... < DataManager:139 < *:89 < Context:299 < Main:137 < ...)

my config is this:

    <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://192.168.1.32:3307/traccar?serverTimezone=UTC&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'>gps</entry>
    <entry key='database.password'></entry>

Please tell me what am I doing wrong?
Thanks

Ronaldo3 years ago

1 - have you restarted the MYSQL service since you are using another port?

2 - your MYSQL configuration file is missing expressions (wrong syntax).

3 - remember the minimum requirements for traccar to work.

Mohamed3 years ago

Hello Tonaldo,
MySQL service is working fine on the new port, I can connect to the server with SQLYOG, I already created the database. I can connect through network and localhost, turened off the firewall too.
Also what do you mean by "your MYSQL configuration file is missing expressions (wrong syntax)."
Thanks for help

Anton Tananaev3 years ago

The error is pretty self explanatory. Traccar server is not able to connect to the database. It's an issue with database or your config parameters.

Mohamed3 years ago

Hello Anton,
I have installed 2 applications on the Traccar server and successfully connected to the mentioned MySQL server, which eliminates connectivity issues, firewall and MySQL server misconfiguration.
Is there any connector software required to be used with Traccar? like JDBC Driver for MySQL (Connector/J). or if there is any connection string that can be added?
Thanks a lot and sorry for any inconvenience

Anton Tananaev3 years ago

Traccar already includes Connector/J.

I have installed 2 applications on the Traccar server and successfully connected to the mentioned MySQL server, which eliminates connectivity issues, firewall and MySQL server misconfiguration.

The error comes directly from the database driver, so either there is some crazy error in the MySQL driver or you are wrong. I feel like latter is more likely.

Ronaldo3 years ago
  • make sure that the MYSQL service is already started when the TRACCAR service starts;

  • if you have not configured MYSQL to receive remote connections, then 192.168.1.32 in the configuration file will not work and you should use addresses type "localhost";

  • what is your hardware configuration?

  • who is "Tonaldo"?

Mohamed3 years ago

Hello Ronaldo
Sorry for mistyping the name, MySQL server is working fine for some other applications, I will try to reinstall all from the beginning(New windows, MySQL server and Traccar) and let you know what happened.
Thanks

Omar Riffo3 years ago

Ok, i try to move from H2 to MySQL and I start having problems on MySQL, so I reinstall Centos7, then MySQL8 and then Traccar, and it works!

Mohamed3 years ago

Yes, I also have reinstalled new windows server 2016 and new MySQL6 and it worked fine so I tested the MySQL8 and it worked too, my problem was that I had a preconfigured MySQL V6 & V8 server which was some how not able to grant the creation right to the GPS user. as a conclusion we need to make sure of the MySQL user's privileges which will be used to connect to Traccar.
Thank you guys for the great software.