开放3306端口:
centos7防火墙不是改成firewalld了吗?但我在阿里云centos7.0中却发现它仍然是iptables,所以开放端口还是得用iptable
vim /etc/sysconfig/iptables
在文件中添加如下代码:
-A INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT

保存后重启iptables
systemctl restart iptables.service

开放mysql远程连接权限:

进入mysql:
mysql -uroot -p
use mysql;
update user set host=’%’ where user=’root’ and host=’localhost’;
FLUSH PRIVILEGES;