Loading... <p><strong>在windows下: <br /></strong>打开命令行窗口,停止mysql服务:        net stop mysql <br />启动mysql,一般到mysql的安装路径,找到 mysqld-nt.exe ( 或者是mysql.exe ) <br />执行:mysqld-nt --skip-grant-tables 当前窗口将会停止。 <br />另外打开一个命令行窗口,执行mysql   如果提示没有这个命令,先进入MYSQL的安装位置下BIN目录再运行mysql>use mysql <br /><font color="#4f81bd">>update user set password=password("new_password") where user="root"; <br />>flush privileges; <br />>exit</font> </p> <p>用Ctrl+Alt+Del,找到mysqld-nt的进程杀掉它,在重新启动mysql-nt服务( net start mysql ),就可以用新密码登录了</p> <p> <br /><strong>在linux下:</strong> <br />如果 MySQL 正在运行,首先杀之: <font color="#4f81bd">killall -TERM mysqld</font>。 <br />启动 MySQL :<font color="#4f81bd">bin/safe_mysqld --skip-grant-tables & <br /></font>就可以不需要密码就进入 MySQL 了。 <br />然后就是 <br /><font color="#4f81bd">>use mysql <br />>update user set password=password("new_pass") where user="root"; <br />>flush privileges; <br /></font>重新杀 MySQL ,用正常方法启动 MySQL 。</p> Last modification:October 6, 2023 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的文章对你有用,请随意赞赏
One comment
路过,支持!