
1、登陆mysql
mysql -uroot -p'password'
2、查看用户信息
select host,user,plugin,authentication_string from user;

注:host:%表示可以在任意主机通过root用户登陆MySQL,localhost表示只能本地登陆。
plugin:身份认证插件,把caching_sha2_password改为mysql_native_password
3、修改信息
alteruser 'root'@'%' identified with mysql_native_password by 'password'
#password为密码
select host,user,plugin,authentication_string from user;

4、使用navicat连接mysql

网友评论