- 打开mysql文件夹,找到/etc/my.cnf配置文件,在/etc/my.cnf末尾 加入skip-grant-tables,保存,跳过身份验证。
- 重启MySql,使刚才修改的配置生效。
- 终端输入mysql,然后再输入use mysql;
- 终端输入update mysql.user set authentication_string=password(‘123456’) where user=‘root’;
- 在/etc/my.cnf末尾 去掉skip-grant-tables,保存。
- 重启MySql,终端输入 mysql -u root -p ,然后根据提示输入刚设置的密码即可正常使用了。
震惊!Linux下忘记mysql密码他竟这样做
猜你喜欢
转载自blog.csdn.net/mrliqifeng/article/details/71177419
今日推荐
周排行