mysql忘掉了root密码

Posted by 猪头小队长 | 程序设计 | Wednesday 7 July 2004 11:24

用这个方法可以改掉密码,出处:www.freelamp.com by 徐永久
如果 MySQL 正在运行,首先杀之: killall -TERM mysqld。
启动 MySQL :/usr/bin/safe_mysqld –skip-grant-tables &
就可以不需要密码就进入 MySQL 了。
然后就是
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
重新杀 MySQL ,用正常方法启动 MySQL 。

还有一个参数需要注意:mysql是否监听tcp端口,这个是在mysql的配置文件my.cnf中:skip-networking
如果有此开关,则不监听,如果想要那个3306则注释掉此开关。

[@more@]

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.