Cant Get Mysql to work

Nick4 years ago

Hello,

everything is working normal out of the box. However I want to use a mysql database instead.
I have created a database 'track' in mysql (XAMPP).

I have altered the traccar.xml file as follows: However its still using the embedded database.

<?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/track?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'></entry>

</properties>
Anton Tananaev4 years ago

What's the error?

Nick4 years ago

There is no error. It just keeps using the embedded database and not MySQL.

Anton Tananaev4 years ago

Have you restarted the service?

Nick4 years ago

yes. So I changed the Config file to:

<entry key='database.driver'>com.mysql.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://127.0.0.1:3306/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'>root</entry>
<entry key='database.password'>password</entry>

And now get this error.

2020-09-08 23:19:38  WARN: Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2020-09-08 23:19:43 ERROR: HikariPool-1 - Exception during pool initialization. - Public Key Retrieval is not allowed - UnableToConnectException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)
2020-09-08 23:19:43 ERROR: Main method error - Public Key Retrieval is not allowed - UnableToConnectException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)
2020-09-08 23:19:43  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@15d49048 threw the following exception - Public Key Retrieval is not allowed - UnableToConnectException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)
Anton Tananaev4 years ago

OK. Have you done any research before asking on the forum? Googling quickly gives me this solution:

AllowPublicKeyRetrieval=True