[스프링 부트] chapter 27. 스프링 데이터 3부 MySQL

스프링 데이터 3부 MySQL

지원하는 DBCP

DBCP 설정

MySQL 커넥터 의존성 추가

<dependency>
	<groupId>mysql</groupId>
	<artifactId>mysql-connector-java</artifactId>
</dependency>

MySQL 추가(도커 사용)

MySQL용 Datasource 설정

MySQL 접속시 에러

MySQL 5.* 최신 버전 사용할 때

문제 Sat Jul 21 11:17:59 PDT 2018 WARN: 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.
해결 jdbc:mysql:/localhost:3306/springboot?useSSL=false

MySQL 8.* 사용할 때

문제 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed
해결 jdbc:mysql:/localhost:3306/springboot?useSSL=false&allowPublicKeyRetrieval=true

MySQL 라이센스 주의 (GPL)