1. 문제의 발견

 

  Ubuntu 18.04 LTS 를 기준으로 소스 설치를 하지 않는 이상 대게 apt install mariadb-server 명령어를 통해 MariaDB 를 설치한다. 그 후, mysql_secure_installation 명령어를 통해 최초 기본 설정을 진행하게 되는데 그 설정 가운데 root password 를 설정할 수 있는 step 이 존재한다.  필자는 해당 step 에서 설정한 비밀번호를 바탕으로 MariaDB 접속을 시도했는데, 비밀번호가 없이도 접속이 가능했다. 즉, password 설정이 제대로 안된 것이다.

 

2. 원인

 

 그 이유는 다음과 같다. MariaDB 10.4.3 버전 이상부터는 local Unix socket file 을 통해 MariaDB 를 접근하려고 하는 것이 default 로 설정이되어 있는데, 이 때는 운영 체제 자체의 "증명" 을 따른다는 것이다. 쉽게 이야기 하자면, OS 자체의 비밀번호 설정을 따른다는 것인데 이렇게 되면 최초 기본 설정 시에 (mysql_secure_installation) 설정했던, MariaDB root password 설정이 제대로 작동하지 않는다. 

 

3. 해결방안 

 

 해당 부분을 disable 시키고 MariaDB 자체에 설정해놓은 root password 를 실제 MariaDB 접속 시에 사용하고자 한다면, MariaDB 의 mysql database > user table 에서 다음과 같은 명령어를 사용하면 된다. [ UPDATE user SET plugin=""; ] 
그 후에, MariaDB root password를 재설정한다면 재설정한 password를 바탕으로 접속이 가능할 것이다. 

 

4. 참고

 

https://mariadb.com/kb/en/authentication-plugin-unix-socket/

 

Authentication Plugin - Unix Socket

Uses the user name that owns the process connected to MariaDB's unix socket file.

mariadb.com

https://mariadb.com/kb/en/after-reset-root-password-i-still-get-access-denied-for-user-rootlocalhost/

 

after reset root password I still get "Access denied for user 'root'@'localhost'"

I reset the root password of the mariadb server but when I then try to login, I still get Access denied for user 'root'@'localhost' To change the root password I did the follo...

mariadb.com

 

'DB > RDB' 카테고리의 다른 글

Isolation level 이란  (1) 2020.04.17

+ Recent posts