【问题标题】:amazon rds db error Error: connect ETIMEDOUTamazon rds db error 错误:连接 ETIMEDOUT
【发布时间】:2019-06-24 17:28:41
【问题描述】:

我正在尝试将 Amazon RDS DB 连接到我的 nodeJs 应用程序,但我收到一个错误并且我的配置是这样的

const connection = mysql.createConnection({
    host: '***********.*************.************.amazonaws.com',
    user: '**********',
    password: '************',
    database: '************',
    port: '3306',
  });
  connection.connect((err) => {
    if (!err) {
      start();
    }
  });

【问题讨论】:

标签: mysql node.js amazon


【解决方案1】:

您也可以尝试使用 ssh 并参考 https://www.npmjs.com/package/mysql-ssh 这个库

【讨论】:

    【解决方案2】:

    我通过在 RDS 实例的安全组中添加以下入站规则解决了我的问题:

    Type: MySQL/Aurora
    Protocol: TCP
    Port range: 3306
    Source: <Security group of the EC2 instance running Node app> OR <IP address of the machine running Node App>
    

    【讨论】:

      猜你喜欢
      • 2022-11-18
      • 1970-01-01
      • 1970-01-01
      • 2022-10-21
      • 2017-02-13
      • 1970-01-01
      • 2021-07-03
      • 1970-01-01
      • 2019-12-24
      相关资源
      最近更新 更多