于洋博客 互联网点滴记忆

23Nov/110

重置忘记的MYSQL密码

[root@jk ~]# service mysqld stop
Stopping MySQL: [ OK ]
[root@jk ~]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 24688
[root@jk ~]# Starting mysqld daemon with databases from /var/lib/mysql

[root@jk ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.0.91-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=password('******') where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3 Changed: 0 Warnings: 0

mysql> quit
Bye
[root@jk ~]# service mysqld restart
STOPPING server from pid file /var/run/mysqld/mysqld.pid
111123 22:38:01 mysqld ended

Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[root@jk ~]#

Filed under: Mysql Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.