tech/linux

21/07/14 MariaDB root 비밀번호 분실시 초기화

tech-lover 2021. 7. 14. 11:31

1. 서비스 정지

systemctl stop mariadb

 

2. 안전모드 실행

sudo /usr/bin/mysqld_safe –skip-grant &

 

3. 패스워드 변경

mysql -u root mysql

> update user set password=password(‘변경할 비밀번호’) where user=’root’;
> flush privileges;
> exit;

 

4. 패스워드 변경이 되었는지 테스트

mysql -u root -p

 

5. 서비스 시작

systemctl start mariadb