解决mysql用任何密码都能登录的问题


1、use mysql;
 
2、(无password字段的版本)update user set authentication_string=PASSWORD("密码") where user='root';
(有password字段的版本)update user set password=password('密码') where user='root'; 
 
3、update user set plugin="mysql_native_password";
 
4、flush privileges;
 
5、quit;
 
6、重启mysql服务

此外,如果更改了mysql的配置文件后,要重启一下mysql,否则可能会出错


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM