-
스프링 데이터 - MySQL백기선(인프런 강의)/스프링 부트 개념과 활용 2020. 7. 4. 13:09반응형
예제
의존성 추가
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency>
docker 설치
아래 소스 실행
docker run -p 3306:3306 --name mysql_boot -e MYSQL_ROOT_PASSWORD=1 -e MYSQL_DATABASE=springboot -e MYSQL_USER=jinseok -e MYSQL_PASSWORD=pass -d mysql docker exec -i -t mysql_boot bash mysql -u root -p
소스 설치결과
MySQL용 Datasource 설정
spring.datasource.url=jdbc:mysql://localhost:3306/springboot?useSSL=false spring.datasource.username=jinseok spring.datasource.password=pass
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) 주의
- MySQL 대신 MariaDB 사용 검토
- 소스 코드 공개 의무 여부 확인
반응형'백기선(인프런 강의) > 스프링 부트 개념과 활용' 카테고리의 다른 글
스프링 데이터 - PostgreSQL (0) 2020.07.05 스프링 데이터 2부: 인메모리 데이터 베이스 (0) 2020.07.03 스프링 데이터 1부 : 소개 (0) 2020.07.03 CORS(Cross-Origin Resource Sharing) (0) 2020.06.24 HATEOAS(Hypermedia As The Engine Of Application State) (0) 2020.06.22