Spring Cloud Data Flow local server fails to access MySQL DB
search cancel

Spring Cloud Data Flow local server fails to access MySQL DB

book

Article ID: 297099

calendar_today

Updated On:

Products

Support Only for Spring

Issue/Introduction

When starting Spring Cloud Data Flow on local server, it fails to access the MySQL database and reports the following error message:
java -jar spring-cloud-dataflow-server-2.5.3.RELEASE.jar --spring.datasource.url=jdbc:mysql://localhost:3306/cdp --spring.datasource.username=username --spring.datasource.password='password' --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
.
.
.
Caused by: java.sql.SQLInvalidAuthorizationSpecException: Access denied for user 'username'@'localhost' (using password: NO)
        at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:238)
        at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:171)
        at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1128)


Resolution

This error message means the password is not provided and is rejected by the MySQL database. However, it has been supplied with the java command definitely. The reason is that the auth plugin, caching_sha2_password is not compatible with the driver, org.mariadb.jdbc.Driver. In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password

This issue can be solved by switching back to auth plugin mysql_native_password.
alter user 'username'@'localhost' identified with mysql_native_password by 'password';