MySQL忘记密码怎么办?
[color=#FF0000]我在忘记了mysql密码后在网上搜到的,觉得有用就发上来了,在xp sp2+mysql 5.0测试通过。[/color][quote][b]在windows下:[/b]
打开命令行窗口,停止mysql服务: Net stop mysql
启动mysql,一般到mysql的安装路径,找到 mysqld-nt.exe
执行:mysqld-nt --skip-grant-tables
另外打开一个命令行窗口,执行mysql
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
>exit
用Ctrl+Alt+Del,找到mysqld-nt的进程杀掉它,在重新启动mysql-nt服务,就可以用新密码登录了
[b]在linux下:[/b]
如果 MySQL 正在运行,首先杀之: killall -TERM mysqld。
启动 MySQL :bin/safe_mysqld --skip-grant-tables &
就可以不需要密码就进入 MySQL 了。
然后就是
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
重新杀 MySQL ,用正常方法启动 MySQL 。 [/quote][color=#B22222]转自www.senlin.org[/color]