怎么解决mysql远程连接报10038的错误

2025-02-25 16:55:38
推荐回答(2个)
回答1:

第一步:首先设置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。

回答2:

解决方案如下:
1、授权
mysql>grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;

mysql>flush privileges;
2、修改/etc/mysql/my.conf
找到bind-address = 127.0.0.1这一行
改为bind-address = 0.0.0.0即可