Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save devheedoo/6fc8f7b2c162b7f082d8622f7a6e83a2 to your computer and use it in GitHub Desktop.
Save devheedoo/6fc8f7b2c162b7f082d8622f7a6e83a2 to your computer and use it in GitHub Desktop.

발생 원인

MySQL 을 사용하는 경우,

ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client

위와 같은 오류를 만났다면 이는 암호화 방식의 차이 때문이다.

기존에는 mysql_native_password 방식을 사용했지만 MySQL8은 디폴트로 caching_sha2_password 방식을 사용한다.

mysql과 연동하는 여러 라이브러리들이 아직 mysql_native_password 방식을 사용하고 있기 때문에 연동과정에서 불일치가 발생한다.

해결 방법

사용자 하나만 변경

사용자 하나만 비밀번호 방식을 바꾸는 쿼리는 아래와 같다.

ALTER USER '사용자ID'@'localhost' IDENTIFIED WITH mysql_native_password BY '비밀번호';

디폴트 암호화 방식 변경

사용자 하나만 변경하면 다른 사용자와 연결할 때 또 오류가 발생할 수 있다. 디폴트 암호화 방식을 변경하려면 my.cnf 파일에서 아래와 같이 설정하면 된다.

[mysqld]
default-authentication-plugin=mysql_native_password

MySQL 버전 변경

MySQL 5.7까지는 mysql_native_password 방식을 사용한다. 기존 MySQL8을 제거하고, MySQL5.7을 설치해서 사용한다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment