root 패스워드를 잃어 버렸을때, 패스워드를 변경하는 방법
(1) ps -aux를 이용하여 mysqld 프로세스를 kill 시킨다.
[root@dbadb local]# ps -aux | grep mysql
(2) mysqld를 시작한다. 이때 --skip-grant-tables 옵션을 사용한다.
[root@dbadb local]# ./mysql/bin/mysqld_safe --user=mysql --skip-grant-tables &
[root@dbadb local]# ./mysql/bin/mysqld_safe --user=mysql --skip-grant-tables &
[1] 643
[root@dbadb local]# Starting mysqld daemon with databases from /usr/local/mysql/var
(3) root 패스워드를 변경한다.
[root@dbadb local]# cd mysql/bin
[root@dbadb mysql]# bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.16
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
mysql> update user set password=password('newpassword') where user='root';
mysql> flush privileges;
mysql> quit;
Bye
댓글 없음:
댓글 쓰기