1:修改root的host为%
2:设置root plugin为自己的密码
update mysql.user set authentication_string=PASSWORD('your passwd'), plugin='mysql_native_password' where user='root';
3:修改配置文件里的mysql绑定的地址为0.0.0.0
vim /etc/mysql/mysql.conf.d
4:还有配置文件里的一些permitrootlogin等设置为yes
这个思路设置完就可以了