How to resolve error "public key retrieval is not allowed"

Hello for everyone,

I was with a trouble to change my database from H2 to MYSQL, i follow the instructions from official documentation of traccar https://www.traccar.org/mysql/

these errors appeared:

WARN: Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2020-02-20 13:20:37 ERROR: HikariPool-1 - Exception during pool initialization. - Public Key Retrieval is not allowed - UnableToConnectException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)
2020-02-20 13:20:37 ERROR: Main method error - Public Key Retrieval is not allowed - UnableToConnectException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)
2020-02-20 13:20:37  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@78452606 threw the following exception - Public Key Retrieval is not allowed - UnableToConnectException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)

SOLUTION:

In this line

<entry key='database.url'>jdbc:mysql://[HOST]:3306/[DATABASE]?serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>

Add these parameters on traccar.xml:
allowPublicKeyRetrieval=true
useSSL=false

It will look like this:

<entry key='database.url'>jdbc:mysql://[HOST]:3306/[DATABASE]?allowPublicKeyRetrieval=true&amp;useSSL=false&amp;serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
TDIGITALI3 years ago

Thanks Pedro, I fixed

Artem3 years ago

Thanks Pedro !