Database/MySQL

[MySQL] Access denied for user '유저 아이디'@'localhost' (using password: YES): 로그인 실패 에러

sechoi 2023. 2. 3. 01:31

문제 상황

- mysql 8.x 버전 사용 중

- 터미널에서 mysql -u '유저 아이디' -p로 로그인 할 시 성공함

- 해당 유저에게 권한 부여도 완료함

- 인텔리제이 Database 설정에서도 로그인이 성공되어 데이터베이스가 연결됨

 

- 그런데 똑같은 설정으로 스프링부트를 실행하면 제목과 같은 에러가 발생한다...

 

해결 과정

처음에는 로그를 보고도 로그인에 문제가 있을 거라는 생각을 못했다. 그래서 다른 에러 로그를 구글링하다가 우연히 이 글을 보게 되었다. 나와 문제 상황이 똑같았는데, 어이없게도 비밀번호를 변경하니까 해결되었다는 것이다. 마침 내가 설정해 놓은 비밀번호도 네자리 수의 간단한 비밀번호였다. 그래서 영어를 섞어 비밀번호를 수정했더니 해결되었다. 이게 무슨...

 

MySQL 8.0 기준 보안이 약한 비밀번호를 사용하면 연동에 문제가 발생하는 걸로 추측된다. 

In MySQL 8.0, the validate_password plugin was reimplemented as the validate_password component. The 
validate_password plugin is deprecated; expect it to be removed in a future version of MySQL. Consequently, its options are also deprecated, and you should expect them to be removed as well. MySQL installations that use the plugin should make the transition to using the component instead. See 
Section 6.4.3.3, “Transitioning to the Password Validation Component”.

https://dev.mysql.com/doc/refman/8.0/en/validate-password-options-variables.html

 

MySQL :: MySQL 8.0 Reference Manual :: 6.4.3.2 Password Validation Options and Variables

6.4.3.2 Password Validation Options and Variables This section describes the system and status variables that validate_password provides to enable its operation to be configured and monitored. Password Validation Component System Variables If the validate

dev.mysql.com

이 버전부터 validate_password 플러그인도 변경되고 인증 정책이 caching_sha2_password로 바뀌었다고 한다. 즉 보안이 더 깐깐해졌다는 것이다. 현재로선 이 때문에 문제가 발생한 것으로 추측된다. (그럼 처음에 비밀번호 설정할 때도 default로 막아주든가...)

'Database > MySQL' 카테고리의 다른 글

[MySQL/InnoDB] Gap Lock(갭 락)의 실행 원리 탐구  (0) 2023.09.16