Can't Set Up MySQL Connection: CLIENT_PLUGIN_AUTH is required

Problem

Attempting to create a connection to a MySQL Database fails with the error below:

java.lang.RuntimeException: could not create jdbc connection to jdbc:mysql://host:3306/database_name
Caused by: com.mysql.cj.core.exceptions.UnableToConnectException: CLIENT_PLUGIN_AUTH is required

Cause

Mentioned com.mysql.cj.core.exceptions.UnableToConnectException most likely comes from version 6 of MySQL Connector/J, when you try to connect to a relatively old MySQL instance. (Please refer to Supported Data Sources to check if the version of MySQL instance you are trying to connect to is supported.)

Name of the class that implements java.sql.Driver in MySQL Connector/J has changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver in version 6. Please refer to Changes in the Connector/J API.

When you use mysql-connector-java-6.0.6.jar as a default MySQL JDBC driver (stored at etc/custom-jar/) and would like to set up a connection to a relatively old MySQL instance, it might fail with the error message mentioned above.

You can try to workaround the problem by setting up custom database driver using one of previous versions of MySQL Connector/J (e.g. 5.1.44), but this still might not work. When one creates a custom Database Driver and uploads another version of the mysql-connector-java jar file, a new connection that will be created in the future would have both jars (default and custom) in it's classpath. In case that the default mysql-connector-java-6.0.6.jar from etc/custom-jar/ is picked up first, it will be used instead of the custom driver.

 

Datameer recommends using generally available versions of MySQL Connector/J. 

 

Solution

Here are the steps to replace mysql-connector-java-6.0.6.jar if you use it as the default one.

  • Remove all custom MySQL drivers you might have created to fix this problem and keep only the embedded one.
  • Stop Datameer.
  • Ensure that the service has been really stopped and no datameer processes are running.
  • Clean up /<Datameer installation folder>/temp and /<Datameer installation folder>/tmp folders.
  • Replace the /<Datameer installation folder>/etc/custom-jars/mysql-connector-java-6.0.6.jar file with mysql-connector-java-5.1.44.jar. or any other recent GA version of MySQL Connector/J
  • Start Datameer.