広告

Establishing SSL connection without server’s identity verification is not recommended. とか Public Key Retrieval is not allowed など

MySQL 8 で SSL 使ってないといろいろ出ます。Spring Boot 2 を使っていて、下記のようなログが出る場合、

Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

例えば、

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/mokyu?useSSL=false
    username: mokyu
    password: mokyu1234

さらに下記のようなログで Spring Boot アプリケーションを起動できない場合、

java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed

Unable to determine jdbc url from datasource

HHH000342: Could not obtain connection to query metadata : Public Key Retrieval is not allowed

例えば、

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/mokyu?useSSL=false&autoReconnect=true
    username: mokyu
    password: mokyu1234

広告

MySQL

Posted by admin