liunx mysql 忘记密码



我参考了这连篇博客

https://blog.csdn.net/iloveyougirls/article/details/77826870


https://blog.csdn.net/w690333243/article/details/79071131


但是出错了

说说正确的方法

2、mysql的真正配置应该在/etc/mysql/mysql.conf.d/mysqld.cnf 文件中

在文件中加入skip-grant-tables

参考一

sudo /etc/mysql/mysql.conf.d/mysqld.cnf

3、重启mysql服务:sudo service mysql restart  

4、输入命令:mysql (可以直接进入mysql)

5、use mysql  (切换至mysql数据库)

6、update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost'; 



参考二


mysql->update user set plugin="mysql_native_password";

mysql->flush privileges;

mysql->quit;

最后注释行才写在文件里面的文件


猜你喜欢

转载自blog.csdn.net/qq_33291307/article/details/80398520
今日推荐