DA安装后设置MYSQL的root密码–通用于忘记密码.

此方法也用于忘记MYSQL的root密码….
[quote][root@free2 root]# service mysqld stop [color=Orange]///停止MYSQL服务[/color]
Killing mysqld with pid 29873
[root@free2 root]# killall -TERM mysqld [color=Orange]///杀死mysqld进程..这个是没成功,因为之前停了MYSQL服务了,可以忽略[/color]
mysqld: no process killed
[root@free2 root]# /usr/bin/safe_mysqld –skip-grant-tables [color=Orange]///用–skip-grant-tables参数启动MYSQL[/color]
Starting mysqld daemon with databases from /var/lib/mysql
update user set password=password(“STOPPING server from pid file /var/lib/mysql/free2.mrwl.net.pid
051230 15:58:48 mysqld ended

反应慢的话,另开SSH:
[root@free2 root]# mysql mysql [color=Orange]///进MYSQL[/color]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42 to server version: 4.0.23-standard-log

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> update user set password=password(“xxxxxx”) where user=”root”; [color=Orange]///设置root密码[/color]
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> exit [color=Orange]///退出MYSQL[/color]

[root@free2 root]# killall -TERM mysqld [color=Orange]///重新杀死MYSQL[/color]
[root@free2 root]# service mysqld start [color=Orange]///正常启动mysqld[/color]
[root@free2 root]#[/quote]

然后就可以用root登陆MYSQL了

2005年12月30日 | 归档于 Fedora, 早期帖子
标签:
本文目前尚无任何评论.

发表评论

XHTML: 您可以使用这些标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>