阿里云centos7安装mysql 5.7 无法远程连接

这里我远程连接修改的几个地方写一下:

1. 设置root 外部访问权限,

mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected]"%" IDENTIFIED BY "root";
mysql> flush privileges;


这是新建用户设置访问权限 

mysql>grant all on databasename.* to 'username'@'%' identified by 'password' with grant option;


2.设置防火墙

我这里是直接关闭防火墙

systemctl stop firewalld 

service iptables stop


3.设置安全组

添加3306端口


4.配置my.cnf文件          --> 之前我上面的都配置好了,就是不行。网上也没有搜到说要配置这个文件的。不知道是我的系统原因还是什么原因,最后在群里问人才知道的。把问题解决了。

在[mysqld] 下面添加 bind-address=0.0.0.0

阿里云centos7安装mysql 5.7 无法远程连接