카테고리 없음

Mysql 비밀번호 재설정

DDooyong94 2019. 7. 12. 14:04

삶이 바쁘다가 가끔 mysql에 접속하려고 하면

비밀번호 생각이 전혀 나지않는다...

 

이번에도 삽질하다가 겨우 비밀번호 재설정을 하게되었다.

적어놓고 쓰자 이제.

 

환경 : Linux CentOS 7 

 

1. systemctl stop mysqld

2. systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
3. systemctl start mysqld

4. mysql -u root

5. UPDATE mysql.user SET authentication_string = PASSWORD('yourPw')  WHERE User = 'root' AND Host = 'localhost';

6. systemctl stop mysqld

7. systemctl unset-environment MYSQLD_OPTS

8. systemctl start mysqld

 

 

 

 

 

 

 

 



출처: https://yoo-hyeok.tistory.com/67 [유혁의 엉터리 개발]