mySQL忘记管理密码的解决方法 ! 如果mySQL正在运作,请先关闭.
关闭方法:很文博客-https://www.zhenjiekeji.com/60146.html
service mysqld stop很文博客-https://www.zhenjiekeji.com/60146.html
或很文博客-https://www.zhenjiekeji.com/60146.html
killall -TERM mysqld很文博客-https://www.zhenjiekeji.com/60146.html
接下来,重新开启mySQL,请额外加上指令:很文博客-https://www.zhenjiekeji.com/60146.html
/usr/bin/safe_mysqld --skip-grant-tables &很文博客-https://www.zhenjiekeji.com/60146.html
(请注意执行程式的路径,请替换成你的程式路径)很文博客-https://www.zhenjiekeji.com/60146.html
然后启动mySQL,在命令模式下键入:mysql
# mysql (这个也是,如果直接执行找不到程式,请打完整路径)
>use mysql
>update user set password=password("新密碼") where user="root";
>flush privileges;
>exit;
关闭现在执行的mySQL,重新正常启动mySQL。
启动mysql命令:
mysql -h localhost -uroot -p
password
->
我的微信
微信号已复制
扫一扫更精彩
大家的支持是我更新的动力!!!




