0

Java Version 1.8 mysql-connector-java 8.0.12 My SQL 5.7 deployed on docker

SUCCESSFULLY connect to workbench

PROPERTIES

database:
  driverClass: com.mysql.cj.jdbc.Driver
  url: jdbc:mysql://localhost:3306/todo?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
  user: root
  password: <pwd>
  maxWaitForConnection: 1s
  validationQuery: "/* ToDoService Health Check */ SELECT 1"
  validationQueryTimeout: 3s
  minSize: 8
  maxSize: 32
  checkConnectionWhileIdle: false
  evictionInterval: 10s
  minIdleTime: 1 minute
  checkConnectionOnBorrow: true

ERROR DETAILS I am trying to test a simple test dropwizard application by using a MySQL server that id deployed on docker. I can connect to the MySQL server just fine from the Workbench. So I know I can connect fine using my userid and pwd.But when I try to test a simple dropwizar Java application I am getting following exception.

STACKTRACE

INFO [2020-03-04 13:59:26,161] org.eclipse.jetty.server.handler.ContextHandler: Started i.d.j.MutableServletContextHandler@28babeca{/,null,AVAILABLE} 
INFO [2020-03-04 13:59:26,182] org.eclipse.jetty.server.AbstractConnector: Started application@1caa9eb6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} 
INFO [2020-03-04 13:59:26,183] org.eclipse.jetty.server.AbstractConnector: Started admin@1f53481b{HTTP/1.1,[http/1.1]}{0.0.0.0:8081} 
INFO [2020-03-04 13:59:26,184] org.eclipse.jetty.server.Server: Started @3009ms 
ERROR [2020-03-04 13:59:32,591] org.apache.tomcat.jdbc.pool.ConnectionPool: Unable to create initial connections of pool. ! com.mysql.cj.exceptions.CJException: Access denied for user 'root'@'localhost' (using password: YES) ! at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ! at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ! at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ! at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:810) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:735) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:703) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:132) ! at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:557) ! at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:220) ! at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1443) ! at com.mysql.cj.NativeSession.connect(NativeSession.java:165)
rbr94
  • 2,227
  • 3
  • 23
  • 39
Alchemist
  • 849
  • 2
  • 10
  • 27
  • `Access denied for user 'root'@'localhost' (using password: YES)` is written in the stacktrace... – zloster Mar 04 '20 at 14:43
  • Why access denied when the sam user and password works fine to connect using SQL Workbench. And found that if we reduce the version of MySQL to 5.5 I do not get this error. – Alchemist Mar 04 '20 at 18:30
  • At minimum there is change in the defaults for the `root` account between 5.5 and 5.7. Here are some hints: https://stackoverflow.com/questions/38311094/access-denied-for-user-rootlocalhost – zloster Mar 05 '20 at 18:25

0 Answers0