티스토리 뷰

MariaDB 비밀번호 분실한 경우 새 비밀번호 생성

 

1. 서비스 정지

systemctl stop mariadb

 

2. mariadb 안전모드 실행

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

[root@localhost ~]# 190530 21:30:25 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
190530 21:30:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

 

3. 안전모드로 접속해서 root계정 비밀번호 변경

mysql -uroot mysql

MariaDB [mysql]> update user set password=password('변경할 비밀번호') where user='root';

MariaDB [mysql]> flush privileges;

MariaDB [mysql]> exit;

 

4. 접속 확인

mysql -uroot -p
Enter password:

MariaDB [(none)]> 

 

5. 서비스 재시작

systemctl stop mariadb
systemctl start mariadb
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함