无法从Amazon EC2服务器上的远程服务器连接MySQL数据库

问题描述:

  1. 我在AWS EC2实例( Server1 )上使用带有centos-7的MySql版本5.7.17
  2. 我在"/etc/my.cnf"中添加了条目"bind-address = 0.0.0.0"
  3. 在安全组中为0.0.0.0/0的端口3306添加了入站规则
  4. 添加了新用户并通过以下查询分配了所有权限
  5. 上授予所有特权.以'password'标识的bob @'%';
  6. 平常特权;
  7. 另一个EC2实例( Server2 )在同一VPC上.
  1. I am using MySql Version 5.7.17 with centos-7 on AWS EC2 Instance(Server1)
  2. I have added entry "bind-address=0.0.0.0" in "/etc/my.cnf"
  3. Added inbound rule in security group for port 3306 with 0.0.0.0/0
  4. Added new user and assigned all privileges with following queries
  5. GRANT ALL PRIVILEGES ON . TO bob@'%' identified by 'password';
  6. FLUSH PRIVILEGES;
  7. Another EC2 instance(Server2) is on same VPC.

仍然,我无法将MySQL数据库从远程服务器( Server2 )连接到服务器( Server1 ).

Still,I am not able to connect MySQL database from remote server(Server2) to server(Server1).

远程数据库连接现在正在工作.

Remote db connection is working now.

我在远程服务器( Server2 )

setsebool -P httpd_can_network_connect_db = 1