第一步:首先设置root用户的host为所有IP: 进入Mysql: mysql -uroot -pyoupass 进入后use mysql 然后,update user set host=’%’ where user=’root’ and host=’localhost’; flush privileges; 上面这一步注意分号,设置完了可以 select user,host from user表看看,设置成功没。 第二步: 如果你是云服务器,要去设置my.cnf 把下面bind-address 设置成你的云服务器的外网IP。
