无法从Amazon EC2服务器上的远程服务器连接MySQL数据库
问题描述:
- 我在AWS EC2实例( Server1 )上使用带有centos-7的MySql版本5.7.17
- 我在"/etc/my.cnf"中添加了条目"bind-address = 0.0.0.0"
- 在安全组中为0.0.0.0/0的端口3306添加了入站规则
- 添加了新用户并通过以下查询分配了所有权限
- 在上授予所有特权.以'password'标识的bob @'%';
- 平常特权;
- 另一个EC2实例( Server2 )在同一VPC上.
- I am using MySql Version 5.7.17 with centos-7 on AWS EC2 Instance(Server1)
- I have added entry "bind-address=0.0.0.0" in "/etc/my.cnf"
- Added inbound rule in security group for port 3306 with 0.0.0.0/0
- Added new user and assigned all privileges with following queries
- GRANT ALL PRIVILEGES ON . TO bob@'%' identified by 'password';
- FLUSH PRIVILEGES;
- 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