- 开放Centos6.5的mysql的权限给任何ip地址
进入数据库
mysql -uroot -p
修改MySQL里的root权限
grant all privileges on *.* to 'root'@'%' identified by "Password" with grant option;
注意:Password是你自己要修改的密码
刷新MySQL的系统权限相关表
flush privileges;
- .开放端口
进入iptables文件
vim /etc/sysconfig/iptables
进入之后
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
按a编辑该文件,
添加3306端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
最后按esc,
:wq退出
注意:不要忘记关闭防火墙
- 连接sqlyog
输入相对应的IP地址
centos6.5查看IP地址方法: ifconfig
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:BD:DC:18
inet addr:192.168.0.98 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:febd:dc18/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27315 errors:0 dropped:0 overruns:0 frame:0
TX packets:940 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3387756 (3.2 MiB) TX bytes:216823 (211.7 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
连接sqlyog
完成