메뉴 건너뛰기


Re: == 리눅스 유저께 질문드립니다.

........2002.08.14 13:23조회 수 222댓글 0

    • 글자 크기


MySQL 접속 유저ID와 Passwd를 잃어 버리신거라면 아래와 같이 한번 해보심이... ^^;

MySQL 에서 사용하는 root 암호가 뭔지 모르다면 다음 처럼 바꿉니다.

1. 우선 다음처럼 MySQL 서버데몬을 모조리 죽여 버립니다.

[root@linuxer mysql]# ps -aux | grep my
root 7646 0.0 0.6 1668 808 pts/4 S 09:42 0:00 sh ./bin/safe_mys
root 7740 0.0 0.7 10784 980 pts/4 SN 09:45 0:00 /usr/local/mysql/
root 7742 0.0 0.7 10784 980 pts/4 SN 09:45 0:00 /usr/local/mysql/
root 7743 0.0 0.7 10784 980 pts/4 SN 09:45 0:00 /usr/local/mysql/
root 7747 0.0 0.3 1148 392 pts/4 R 09:45 0:00 grep my

[root@linuxer mysql]# kill -9 7646 7740 7742 7743
[1]+ Killed ./bin/safe_mysqld


2. 그다음 --skip-grant 옵션을 이용
권한테이블을 사용하지 않는 옵션으로 데몬을 띄웁니다.

[root@linuxer mysql]# ./bin/safe_mysqld --skip-grant &
[1] 7759
[root@linuxer mysql]# kill 7743: No such process
Starting mysqld daemon with databases from /usr/local/mysql/data

[root@linuxer mysql]#

여기서 kill 7743: No such process 이런 메시지는 safe_mysqld 스크립트가 가장
마지막에 실행중이던 데몬의 프로세스를 죽이고 다시 시작하려다 못찾아 나오는 에러 메시지 이지만
그냥 데몬이 떠 버렸으니 신경 쓰지 않아도 됩니다.

프로세스를 확인해 보면....

[root@linuxer mysql]# ps -aux | grep my
root 7759 0.0 0.6 1668 812 pts/4 S 09:49 0:00 sh ./bin/safe_mys
root 7775 0.0 0.5 2520 696 pts/4 SN 09:49 0:00 /usr/local/mysql/
root 7777 0.0 0.5 2520 696 pts/4 SN 09:49 0:00 /usr/local/mysql/
root 7778 0.0 0.5 2520 696 pts/4 SN 09:49 0:00 /usr/local/mysql/

이 상태에서는 권한테이블을 사용하지 않으므로 어떤 호스트에서도 아무 사용자로
모든 DB에 접속이 가능합니다.
얼른 작업을 끝내고 권한을 설정해 DB를 다시 띄워야 합니다. ^,^

3. 자 이제 마음놓고 root 로 들어갑니다.
권한을 설정하는 데이타 베이스 mysql 을 이용하겠습니다.

[root@linuxer mysql]# ./bin/mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.22.22

Type 'help' for help.

mysql>

4. 다음처럼 새로운 root 의 암호로 바꾸고

mysql> UPDATE user SET Password=PASSWORD('newpasswd') WHERE user='root';

Query OK, 1 row affected (0.02 sec)
Rows matched: 2 Changed: 1 Warnings: 0

5. 그다음 권한 테이블을 다시 읽고

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

빠져 나갑니다.

mysql> q
Bye
[root@linuxer mysql]#


6. MySQL 서버 데몬을 죽여보도도록 하겠습니다.
그런데 이미 FLUSH PRIVILEGES 옵션으로 권한이 재 설정 된 상이므로
아까 바꾼 암호를 입력해야 합니다.


[root@linuxer mysql]# ./bin/mysqladmin -uroot -p***** shutdown

[root@linuxer mysql]# mysqld daemon ended

[1]+ Done ./bin/safe_mysqld --skip-grant

잘 죽었군요(^,^)

7. 이제 권한 테이블을 이용한 원래의 스크립트를 이용 데몬을 다시 띄웁니다.

[root@linuxer mysql]# ./bin/safe_mysqld &
[1] 7859
[root@linuxer mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data

[root@linuxer mysql]


8. 자 이제 드디어 아까 바꾼 암호로 들어 갈 수 있습니다.

다음의 방법으로 하면 됩니다.

a. # ./bin/mysql -uroot -p**** mysql 를 써도 되고
b. # ./bin/mysql -uroot -p mysql 를 쓰면 암호를 물어 봅니다.

보안상 b 방법을 권해 드립니다. (누가 뒤에서 보면 안되니까요!)

[root@linuxer mysql]# ./bin/mysql -uroot -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.22.22

Type 'help' for help.

mysql> select Host ,User from user ;
+-------------------+-------+
| Host | User |
+-------------------+-------+
| localhost | root |
| linuxer.ditco.com | root |
| localhost | |
| linuxer.ditco.com | |
| localhost | mysql |
+-------------------+-------+
5 rows in set (0.00 sec)

mysql> q


참고 ::::

http://phpschool.com/bbs/view.html?id=29&code=tnt&start=40




    • 글자 크기
Re: == 메뉴이름 변경 == (by ........) Re: == 뜨에....흑석동까지 폭우가,...푸하하하하 (by ........)

댓글 달기

번호 제목 글쓴이 날짜 조회 수
공지 드디어 복구했습니다. 와일드바이크 심폐소생의 변!39 Bikeholic 2019.10.27 2751
38596 Re: == 와일드바이크 팀 프레임 == ........ 2001.09.03 170
38595 Re: == 와일드바이크 서버가 다운되었습니다 == ........ 2002.07.23 193
38594 Re: == 와일드바이크 비상연락망 Ver. 1.05 입니다 === ........ 2000.04.26 199
38593 Re: == 와일드바이크 비상연락망 Ver. 1.05 입니다 === ........ 2000.04.26 182
38592 Re: == 와일드바이크 땜시 == ........ 2001.07.23 244
38591 Re: == 와일드라이트의 홀더작업이 늦어져서 ........ 2001.11.05 301
38590 Re: == 와일드라이트 공동구매 시작일자 예비공고 == ........ 2001.10.29 232
38589 Re: == 오늘부터 내일까지 == ........ 2001.03.05 417
38588 Re: == 에공 ........ 2002.05.23 168
38587 Re: == 앤직님..긴급 메시지...(초급 베테랑 입니다.)(무)^^ ........ 2001.09.18 174
38586 Re: == 아래 담배의 해독그림 수정판 == ........ 2001.08.17 196
38585 Re: == 신월산 번개 사진입니다 == ........ 2000.03.14 167
38584 Re: == 수고하셨습니다. ........ 2002.01.24 155
38583 Re: == 메뉴이름 변경 == ........ 2001.11.09 170
Re: == 리눅스 유저께 질문드립니다. ........ 2002.08.14 222
38581 Re: == 뜨에....흑석동까지 폭우가,...푸하하하하 ........ 2000.08.09 155
38580 Re: == 뜨아....흑석동엔 폭우가,... ........ 2000.08.09 167
38579 Re: == 뜨아....강남에는 폭우가,... ........ 2000.08.09 143
38578 Re: == 날으는 짱돌님... ........ 2001.10.13 150
38577 Re: == 날으는 짱돌님 == ........ 2001.07.23 140
첨부 (0)
위로