安装mysql过程中,没有设置密码,在终端输入mysql -uroot -p
输入秘密后报错:ERROR1698(28000):Access denied for user root@localhost
解决办法:
1、终端输入sudo mysql -uroot -p
后直接回车,进入mysql
2、输入use mysql;
然后输入select user,plugin from user;
错误原因是因为plugin root的字段是auth_socket,那我们改掉它为下面的mysql_native_password就行了。
输入update user set authentication_string=password("ln122920"),plugin='mysql_native_password' where user='root';
然后回车执行以下,再输入select user,plugin from user;回车,我们能看到root用户的字段改成功了。
再次重启mysql.
相关参考:https://www.cnblogs.com/cpl9412290130/p/9583868.html
mysql出现ERROR1698(28000):Access denied for user root@localhost的解决方法
猜你喜欢
转载自blog.csdn.net/darling_user/article/details/102615867
今日推荐
周排行