首先 ifconfig查看自己IP:
在 linux 登录数据库:
mysql -uroot -p123456
(我的密码是123456)
1.use mysql;
2.select Host,User from user \G;
查看本地用户并改成任何人可以访问
update user set host='%' where Host="localhost" and User="root";
3.select Host,user from user \G;
再次查看本地用户Host已经变%
4失败,没有关linux防火墙
5.刷新MySQL的系统权限相关表并关防火墙
flush privileges;
systemctl stop firewalld;
7.成功