【MySQL解惑笔记】Navicat 无法远程连接MySQL数据库

安装好Navicat之后远程连接MySQL数据库出现以下报错截图:

 

 出现以上截图怀疑是mysql用户权限不够:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.*.*' IDENTIFIED BY 'yanglt' WITH GRANT OPTION;

 

如果出现以下问题,一般是防火墙端口没有开放:

 

如果服务器时windows服务器

那么看参考此链接:怎么解决mysql远程连接报10038的错误_360新知  http://xinzhi.wenda.so.com/a/1523776948613050

如果是centos7如下:

这里是针对centos7系统firewalld没有开放3306端口:

systemctl status firewalld.service    查看防火墙状态
firewall-cmd --zone=public --list-ports   查看所有打开的端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent    添加3306端口
firewall-cmd --reload     更新防火墙规则
firewall-cmd --zone=public --query-port=3306/tcp  查看3306是否已经开启

 CentOS 7 以下版本 iptables 命令

 如要开放3306端口,输入以下命令即可:

开启3306端口:iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

保存:/etc/rc.d/init.d/iptables save 查看状态:/etc/init.d/iptables status 关闭防火墙 1) 永久性生效,重启后不会复原 开启: chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后复原 开启: service iptables start 关闭: service iptables stop

 

 

关于firewalld更对内容可以参考以下博客:

 https://www.cnblogs.com/moxiaoan/p/5683743.html

posted @ 2018-07-18 11:50  旅行者-Ylt  阅读(423)  评论(0编辑  收藏  举报