mysql 의 root 비밀번호 분실시 대처요령

1. mysqld 를 중지시킨다.

2. bin폴더 혹은 실행파일중에서 아래 명령을 실행

/usr/local/mysql/bin/mysqld_safe –user=root –skip-grant-tables &
혹은 safe_mysqld 이다. 실행파일은 확인할것

3. mysql로 접근
mysql
use mysql

mysql> update user set Password=password(‘새비밀번호’) where Host=’localhost’ and User=’root’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql> quit

4. mysqld 재구동
[root@eshop bin]# killall mysqld_safe

[root@eshop bin]# ps -ax|grep mysqld_safe
Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.3/FAQ

10115 pts/0    S      0:00 /bin/sh ./mysqld_safe –user=root –skip-grant-tables
10161 pts/0    S+     0:00 grep mysqld_safe

[root@eshop bin]# kill -9 10115

[root@eshop bin]# ps -ax|grep mysqld_safe

Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.3/FAQ
10166 pts/0    S+     0:00 grep mysqld_safe
[1]+  죽었음                  ./mysqld_safe –user=root –skip-grant-tables
[root@eshop bin]# /etc/rc.d/init.d/mysqld start

ㅡㅡ

,
Prev 하위 디렉토리까지 뒤져 특정파일의 내용을 replace하기
Next 서버셋팅시, 서버퍼미션설정 (서버초기작업시)

Leave a comment