MySQL [MariaDB] root 패스워드를 분실 했을때 처리방법
페이지 정보
본문
[ CentOS 7 ] root 패스워드를 분실 했을때 처리방법
서비스 정지 -> mysql 안전모드 실행 -> 패스워드 변경 -> 연결테스트 -> 서비스 재시작
1. 서비스 정지
[root@localhost ~]# systemctl stop mariadb
2. mariadb 안전모드 실행
[root@localhost ~]# sudo /usr/bin/mysqld_safe --skip-grant &
[1] 7845
[root@localhost mysql]# 170801 18:02:09 mysqld_safe Logging to '/var/log/mariadb/mysql-error.log'.
170801 18:02:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[1]+ Done sudo /usr/bin/mysqld_safe --skip-grant
3. 패스워드 변경
[root@localhost ~]# mysql -uroot mysql
Mariadb[mysql]> update user set password=password('변경할비밀번호') where user='root';
Mariadb[mysql]> flush privileges;
Mariadb[mysql]> exit;
4. 접속 테스트
[root@localhost ~]# mysql -uroot -p
패스워드 입력 ...
MariaDB[(none)]>
5. 서비스 재시작
[root@localhost ~] systemctl stop mariadb
[root@localhost ~] systemctl start mariadb
관련자료
http://digndig.kr/mysql/793/
http://blog.ivps.kr/7
[ CentOS 6.8 ] root 패스워드를 분실 했을때 처리방법
1. 서비스 정지
[root@localhost ~]# cd /var/lib/mysql
[root@localhost ~]# killall mysqld
2. mariadb 안전모드 실행
[root@localhost ~]# /usr/bin/mysqld_safe --skip-grant &
[2] 15278
[root@localhost ~]# 170228 10:15:46 mysqld_safe Logging to '/var/lib/mysql/localhost.err'.
170228 10:15:46 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql 을 입력하고 엔터
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.21-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set password=password('12345') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> exit
Bye
[root@localhost ~]#
관련자료
http://egloos.zum.com/kiringun/v/1168215
서비스 정지 -> mysql 안전모드 실행 -> 패스워드 변경 -> 연결테스트 -> 서비스 재시작
1. 서비스 정지
[root@localhost ~]# systemctl stop mariadb
2. mariadb 안전모드 실행
[root@localhost ~]# sudo /usr/bin/mysqld_safe --skip-grant &
[1] 7845
[root@localhost mysql]# 170801 18:02:09 mysqld_safe Logging to '/var/log/mariadb/mysql-error.log'.
170801 18:02:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[1]+ Done sudo /usr/bin/mysqld_safe --skip-grant
3. 패스워드 변경
[root@localhost ~]# mysql -uroot mysql
Mariadb[mysql]> update user set password=password('변경할비밀번호') where user='root';
Mariadb[mysql]> flush privileges;
Mariadb[mysql]> exit;
4. 접속 테스트
[root@localhost ~]# mysql -uroot -p
패스워드 입력 ...
MariaDB[(none)]>
5. 서비스 재시작
[root@localhost ~] systemctl stop mariadb
[root@localhost ~] systemctl start mariadb
관련자료
http://digndig.kr/mysql/793/
http://blog.ivps.kr/7
[ CentOS 6.8 ] root 패스워드를 분실 했을때 처리방법
1. 서비스 정지
[root@localhost ~]# cd /var/lib/mysql
[root@localhost ~]# killall mysqld
2. mariadb 안전모드 실행
[root@localhost ~]# /usr/bin/mysqld_safe --skip-grant &
[2] 15278
[root@localhost ~]# 170228 10:15:46 mysqld_safe Logging to '/var/lib/mysql/localhost.err'.
170228 10:15:46 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql 을 입력하고 엔터
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.21-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set password=password('12345') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> exit
Bye
[root@localhost ~]#
관련자료
http://egloos.zum.com/kiringun/v/1168215
댓글목록
등록된 댓글이 없습니다.