コピペワールド

hirooka.pro

MySQL

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

投稿日:

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

[highlight_bash]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.[/highlight_bash]

例えば、

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

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

[highlight_bash]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[/highlight_bash]

例えば、

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

-MySQL

Copyright© hirooka.pro , 2018 All Rights Reserved.