새소식

Database

MySQL 5.7.9 릴리즈 변화된 root 비밀번호 변경하기

  • -

Mac 환경에서 MySQL 5.7.9 버젼 설치 후 root 접속 시도 시 패스워드 장애로 MySQL 접속이 불가능하다.

sudo /usr/local/mysql/support-files/mysql.server stop
sudo mysqld_safe --skip-grant-tables
mysql -u root
update mysql.user set password=password('2261bbs') where user='root';


콘솔 윈도우에서 mysqld_safe 실행으로 safe 모드로 MySQL 데몬을 구동하고 다른 콘솔 윈도우를 띄어 MySQL에 접속한다.

mysql -u root


접속 후 다음 명령어로 root 비밀번호를 업데이트한다.

 

[5.7 이전 버젼]

update mysql.user set password=password('2261bbs') where user='root';
FLUSH PRIVILEGES;


[5.7 이후 버젼]

update user set authentication_string=password('2261bbs') where user='root';
FLUSH PRIVILEGES;

 

 

(5.7 이후 버젼에는 password 필드가 존재하지 않는다.)
설정 후 MySQL 접속 후 명령을 실행하게 되면 다음과 같은 장애가 발생한다.

mysql> SELECT 1;


ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

 

위와 같은 오류가 발생하는 경우 다음과 같은 명령어를 실행한다.

mysql> SET PASSWORD = PASSWORD('2261bbs');
mysql> SELECT 1;

+---+
| 1 |
+---+
| 1 |





Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.