因为执行了一个更改数据库root用户密码的命令,当我更改完后,发现用我新密码和旧密码都能登陆,于是感觉没有输密码,直接回车就能登录,而我在配置中也没有进行免密码登录设置。
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服务