question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MySQL Connection error with default Driver Properties

See original GitHub issue

System information:

  • Operating system (distribution) and version: Pop_OS 20.4
  • DBeaver version: 7.15
  • Additional extensions: None

Connection specification:

  • Database name and version: MySQL 8.0.21
  • Driver name: mysql-connector-java:RELEASE [8.0.17]
  • Do you use tunnels or proxies (SSH, SOCKS, etc)?

Describe the problem you’re observing:

I created a docker instance with the command:

docker run --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d -p 3306:3306 mysql

But when I try to create a new connection, it throws an error saying:

Public Key Retrieval is not allowed

I saw people on stackoverflow changing the driver property AllowPublicKeyRetrieval to true and the option useSSL to false. And it really works. But when I was tweaking the properties, I found that you don’t really need to change those properties to make it work, you can just set useSSL or sslMode to another value, it can be an invalid value, and change this properties back to its default values and the connection works as intented, even if I put useSSL to false, the connection still works with no problem, unless I remove the container and create again, where the initial error returns. In my vision, if it is working with the properties manually set, it should work with the default ones too, this is why I’m submiting this as a bug. If it is not, can someone please explain why this happen?

Steps to reproduce, if exist:

  • Create a new docker container with the command:
docker run --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d -p 3306:3306 mysql
  • Create a connection for MySQL with the root user and the password 123456.

  • When testing the connection, it should throw the error saying Public Key Retrieval is not allowed.

  • Go to the tab Driver Properties, look for the option useSSL change it to false and test the connection, it should give you the same error as before.

  • Now change the property back to true, and the connection should work.

  • The connection works even if I set the property back to false. What I don’t understand.

  • Instead of changing the property to false, you can put any other invalid value, test the connection, it will throw an error saying the value is not acceptable, change the property back to true, the default value, test the connection, and it will work.

  • Instead changing the useSSL property, you can change the sslMode property. Change it from PREFERRED to DISABLED, test the connection, the error will persist, change it back to PREFERRED, the error goes away. You can, too, put a invalid value, test the connection, change it back to PREFERRED and now the connection works.

Include any warning/errors/backtraces from the logs

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
onlineleicommented, Aug 26, 2020

@paulosandinof You should set client option allowPublicKeyRetrieval=true on driver properties tab, more information please reference here

https://github.com/dbeaver/dbeaver/issues/3447

0reactions
serge-ridercommented, Dec 13, 2020

After all I don’t see what we can do here.

DBeaver changes some driver properties implicitly according to connection configuration (e.g. SSL config, target database name and a few others). Thus these user-defined properties are ignored. But this is an expected behavior.

Any ideas are welcome though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

8.4 Connector/ODBC Errors and Resolutions (FAQ)
This error occurs only with MySQL tables using the TEXT or VARCHAR data types. You can fix this error by upgrading your Connector/ODBC...
Read more >
Connection Errors when configuring MySQL 8.0 Database in ...
Open your Ignition Gateway Webpage interface and navigate to the JDBC drivers page. This is found under Configure > Databases > Drivers. Once...
Read more >
Unable to connect to MySQL database - no default driver ...
The specified driver name is invalid. Valid MyODBC 5.3 driver names: {MySQL ODBC 5.3 ANSI Driver} {MySQL ODBC 5.3 Unicode Driver}. Another problem...
Read more >
Error message when you connect to an instance of SQL Server
To work around this behavior, specify a valid, available database in the connection string. To prevent the error when the user's default database...
Read more >
MySQL: Error connecting - Support : DbVis Software
MySQL : Error connecting Print · Open the Properties tab for your MySQL connection · Select Driver Properties · Locate the useSSL property...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found