mysql -uroot -p
在mysql8版本更新用户密码需要加入加密规则 wtth mysql_native_password
注明:mysql8共提供了3种认证方式
# 查看mysql插件信息
show plugins
alter user ‘root‘@‘localhost‘ identified with mysql_native_password by ‘*****‘
# 选择mysql库
use mysql;
# 从user表中列出所有user,host 此时显示的root 用户的host为 localhost
select user,host from user;
# 修改root用户的ip地址为%
update user set host=‘%‘ where user = ‘root‘
# 从user表中列出所有user,host 此时显示的root 用户的host为 %
# 刷新权限信息使更新生效
flush privileges;
# 退出mysql
exit;
关闭防火墙
# 查看防火墙状态信息
systemctl status firewalld
#关闭防火墙
systemctl stop firewalld
#永久关闭防火墙(开机启动时不再启动)
systemctl disable firewalld
使用navicate测试连接
原文:https://www.cnblogs.com/shine-rainbow/p/13170547.html