ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory 해결방법

CODEDRAGON Development/Database

반응형


 


에러메시지

ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

root@b54bdb2da623:/# mysql -h 172.17.0.2 -uroot -p

Enter password:

ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

root@b54bdb2da623:/#

 


 

 

 

에러 원인

MySQL 8.x 부터 기존 인증방식이 달라졌기 때문에 발생합니다. 그래서 기존의 client 8.x 접속시 발생할 있습니다.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.11 MySQL Community Server - GPL

 

 

 

 

 

해결방법

MySQL 서버실행시 옵션을 기본 인증방식을 사용할 있도록 옵션을 추가합니다.(--default-authentication-plugin=mysql_native_password)

 

 

docker run -e MYSQL_ROOT_PASSWORD=mysqlpass -d -p 3306:3306 --name=mysqldb mysql --default-authentication-plugin=mysql_native_password

C:\CodeLab>docker run -e MYSQL_ROOT_PASSWORD=mysqlpass -d -p 3306:3306 --name=mysqldb mysql --default-authentication-plugin=mysql_native_password

37eed683db7ce2b8d9b23d556dca4560fd8ae17076a04b293d3bbe8d60790cd4

 

C:\CodeLab>

 


 

 

MySQL 정상 접속 됩니다.

mysql -h172.17.0.2 -uroot -p