본문 바로가기
DEVELOPER HARRY/ETC.

ERROR#3 MySQL 'caching_sha2_password', 'query_cache_size'

by 갈색토마토 2020. 12. 17.

안녕하세요. Harry입니다.

 

IntelliJ 최초 Setting 중 'MySQL 'caching_sha2_password', 'query_cache_size' 에러가 발생하였는데요.

 

Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.

 

MySQL (TCP/IP) 접속 시 암호화 선택하는 옵션이 없어 발생한 것입니다.

 

해결 방법 첫 번째

설치된 MySQL 경로의 my.ini 파일을 수정한다.

 

my.ini의 경로는 보통 mysql server가 설치된 디렉터리에 존재합니다.

하지만 저와 같이 해당 디렉터리에 존재하지 않는 경우도 있는데요..

이 때는 command 창을 실행하여 찾을 수 있으니 아래의 명령어를 실행하여 찾아주세요.!

 

우선, mysql 디렉토리에 진입해주세요.

 

mysqld –help –verbose 또는 mysqladmin –help

mysql my.ini 경로 이미지#1

명령어를 입력하시면 엄청 스크롤이 생기는데, 내리다 보면 my.ini의 경로가 출력된 것을 확인할 수 있습니다.

 

찾으셨다면 my.ini를 에디터를 이용해서 실행해주시고

default_authentication_plugin을 '#'을 입력하여 주석 처리해주시고

default_authentication_plugin=mysql_native_password를 입력해주신 후 저장해주세요.

저장하셨다면 MySQL 서버를 리스타트해주세요.

 

해결방법 두 번째

Command 창에서 해결하는 방법

 

command창에서 mysql을 접속 후 아래의 명령어를 따라서 실행해주세요.

 

1) mysql -uroot -p 명령어 입력 
2) show databases;
3) use mysql;
4) select host, user, password_last_changed, authentication_String from user;
5) alter user '계정'@'localhost' identified with mysql_native_password by '비밀번호';
6) flush privileges;

 

Test Class 작성 코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.myobject.defaults.sample;
 
import lombok.extern.java.Log;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
 
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
 
import static org.junit.jupiter.api.Assertions.*;
 
@Log4j
public class JDBCTest {
 
    static {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            log.error(e.getMessage());
        }
    }
 
    @Test
    public void test() {
        try (Connection conn = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/defaults?useSSL=false&ServerTimezone=UTC",
                "",
                "")) {
            log.info(conn);
 
        } catch (SQLException e) {
            fail(e.getMessage());
        }
    }
 
}
cs

 

 

 


이상으로 에러에 대한 해결 방법 작성을 마치겠습니다.

 

Harry 올림

 

P.S 광고가 뜬다면, 한 번씩 클릭 부탁드립니다.

(광고 클릭은 포스팅을 이어가는데 큰 힘이됩니다.)

댓글