关于linux系统远程连接mysql数据库报10038的错误

1、首先对用户开启远程连接的权限,开放3006端口,开启其他的ip也能访问%

grant all privileges on *.* to 'root'@'%' identified by 'youpassword' with grant option;

flush privileges;  //刷新MySQL的系统权限相关表

quit; // 退出mysql

youpassword是自己的数据库密码

service mysql restart #重启mysql命令

2、如果还访问不了需要记得关闭防火墙,具体步骤如下

但是centos7的防火墙默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。

1、关闭firewall:

  1. systemctl stop firewalld.service #停止firewall

  2. systemctl disable firewalld.service #禁止firewall开机启动

  3. firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

  4. 到此步骤我的数据库就连接成功啦

发布了93 篇原创文章 · 获赞 9 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/bj123467/article/details/85392795
今日推荐