Spring-Boot 환경에서 CRUD Sample 소스를 다운받아서 테스트를 하기 위해서 로컬 PC에 Mysql 을 설치했다.
bezkoder.com/spring-boot-jpa-crud-rest-api/ => 테스트 소스
Mysql 설치 및 테이블 생성 후, 테스트 소스(Backend) 를 실행 시켰다.
mvn spring-boot:run
Java에서 로컬 MySQL 서버에 연결하던 중 아래와 같은 에러가 발생했다.
java.sql.SQLException: The server time zone value is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
해석하면 '서버 시간대 값이 인식되지 않거나 둘 이상의 시간대를 나타낸다. 서버 또는 JDBC 드라이버(serverTimezone configuration property를 통해)를 구성하여 더 구체적인 표준 시간대 값을 사용해야한다.' 라는 뜻이다.
-------------------------------------------------------------------------------------------------------------
검색 결과 3가지 방법이 있다고 한다. 3가지 방법중 나는 방법2로 적용 테스트를 했다.
방법 1: SET Statement 실행
방법 2: default-time-zone 옵션 지정.
방법 3: JDBC Properties 설정.
이 방법은 서버 재기동이 필요하다. 서버 구동 시 명령줄에 --default-time-zone 옵션을 사용하거나 my.ini 파일 [INI 위치는 링크실행]의 [mysqld]에 추가한다.
# SERVER SECTION # ---------------------------------------------------------------------- # # The following options will be read by the MySQL Server. Make sure that # you have installed the server correctly (see above) so it reads this # file. # # server_type=3 [mysqld] #KST default-time-zone='+9:00' |
파일 수정 후, MySQL 서버를 재기동한다.
다시 아래와 같이 테스트 소스를 실행하니 정상적으로 실행이 되었다.
mvn spring-boot:run
[참고 사이트]