简体   繁体   English

无法连接到远程mysql服务器aws

[英]unable to connect to remote mysql server aws

I woke up this morning and my frontend server could no longer connect to my mysql server. 我今天早上醒来,前端服务器无法再连接到mysql服务器。 I have no idea why: 我不知道为什么:

The internal ip of my frontend server is 172.31.XX . 我的前端服务器的内部ip是172.31.XX

My db server is configured with firewall inbound rules that allow tcp connections on port 3306 via source 172.31.0.0/16 我的数据库服务器配置了防火墙入站规则,该规则允许通过源172.31.0.0/16在端口3306上进行TCP连接

My frontend server is configured with firewall outbound rules that allow tcp connections on port 3306 to the internal ip address of my db server. 我的前端服务器配置了防火墙出站规则,该规则允许端口3306上的TCP连接到数据库服务器的内部IP地址。

The mysql user I use is mysql_prod . 我使用的mysql用户是mysql_prod These are the privileges I have granted for that user on the db server: 这些是我在数据库服务器上为该用户授予的特权:

mysql> show grants for mysql_prod; mysql> show授予mysql_prod;

+--------------------------------------------------------------------------------------------------------------------+ | + ------------------------------------------------- -------------------------------------------------- ----------------- + | Grants for mysql_prod@% | 授予mysql_prod @%| +--------------------------------------------------------------------------------------------------------------------+ + ------------------------------------------------- -------------------------------------------------- ----------------- +

| | GRANT ALL PRIVILEGES ON . 授予所有特权 TO 'mysql_prod'@'%' IDENTIFIED BY PASSWORD '*5B761DF55A90C1E168EC63A3B074A607ECC3B2CA' | 由密码'* 5B761DF55A90C1E168EC63A3B074A607ECC3B2CA'标识为'mysql_prod'@'%'|

| | GRANT ALL PRIVILEGES ON wordpress .* TO 'mysql_prod'@'%' | 将所有特权授予wordpress 。*到'mysql_prod'@'%'|

What am I missing? 我想念什么?

The issue occurred because the mysql bind-address was set to localhost, which prevented remote connections. 发生此问题是因为mysql bind-address设置为localhost,这阻止了远程连接。 I'm not too sure how this conf got reset (the app was working fine the night before). 我不太确定此conf如何重置(前一天晚上该应用程序运行正常)。 Anyways, once I fixed it, it was working fine. 无论如何,一旦我修复它,它就可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM