原文出处:http://apps.hi.baidu.com/share/detail/23010323mysql 在windows下:linux 打开命令行窗口,中止mysql服务: Net stop mysql 启动mysql,通常到mysql的安装路径,找到 mysqld-nt.exe (或mysqld.exe) 执行:mysqld-nt (或mysqld.exe) --skip-grant-tables 当前窗口将会中止。 另外打开一个命令行窗口,执行mysql 若是提示没有这个命令,先进入MYSQL的安装位置下BIN目录再运行mysql >use mysql >update user set password=password("new_password") where user="root"; >flush privileges; >exit 用Ctrl+Alt+Del,找到mysqld-nt的进程杀掉它,在从新启动mysql-nt服务,就能够用新密码登陆了sql 在linux下:windows 若是 MySQL 正在运行,首先杀之: killall -TERM mysqld。 启动 MySQL :bin/mysqld_safe --skip-grant-tables & 注意:原文这里有问题,通过测试后作过更改 就能够不须要密码就进入 MySQL 了。 而后就是 >use mysql >update user set password=password("new_pass") where user="root"; >flush privileges; 从新杀 MySQL ,用正常方法启动app |