Programming/에러노트
[Spring Framework/MySQL] Public Key Retrieval is not allowed
개발도비
2022. 3. 10. 11:03
2021.5.15 작성
Spring과 MySQL, MyBatis를 연동하던 중 Public Key Retrieval is not allowed이라는 오류가 발생했다
나는 MySQL 8.0.24 버전을 쓰고 있는데 8.0버전 이후부터는 설정을 별도로 추가해줘야 한다고 한다
1) MySQL과 MyBatis를 연동할 때 connection이 안 되는 경우
JDBC url에 allowPublicKeyRetrieval=true를 추가해주면 된다
ex) <property name="url" value="jdbc:mysql://127.0.0.1:3306/semo_db01?ㅁuseSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC">
+) 연결할 때 엔티티에 대한 참조에 주의하자. 연결해줄 때 &만 쓰면 안되고 & 로 연결해줘야 한다
2) DBeaver툴에서 connection이 안 되는 경우