Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
连接节点v5.10.1时发生握手不活动超时错误。到aws mysql RDS_Mysql_Node.js_Amazon Web Services_Rds - Fatal编程技术网

连接节点v5.10.1时发生握手不活动超时错误。到aws mysql RDS

连接节点v5.10.1时发生握手不活动超时错误。到aws mysql RDS,mysql,node.js,amazon-web-services,rds,Mysql,Node.js,Amazon Web Services,Rds,我真的很难解决这个问题。当我尝试将节点连接到aws的rds mysql数据库时,我收到以下错误: { [Error: Handshake inactivity timeout] code: 'PROTOCOL_SEQUENCE_TIMEOUT', fatal: true, timeout: 10000 } 在线解决方案建议更新到节点v4.2.1,但我使用的是v5.10.1。 我将节点连接到本地主机mysql时没有问题 这是我的密码: connectionpool = mysql.c

我真的很难解决这个问题。当我尝试将节点连接到aws的rds mysql数据库时,我收到以下错误:

{ [Error: Handshake inactivity timeout]
  code: 'PROTOCOL_SEQUENCE_TIMEOUT',
  fatal: true,
  timeout: 10000 }
在线解决方案建议更新到节点v4.2.1,但我使用的是v5.10.1。 我将节点连接到本地主机mysql时没有问题

这是我的密码:

connectionpool = mysql.createPool({
        host     : 'dev-db.xxxxxx.us-west-2.rds.amazonaws.com',
        user     : 'xxxxx',
        password : 'xxxxx',
        database : 'decurate',

    });

app.get('/:table', function(req,res){
connectionpool.getConnection(function(err, connection) {
        if (err) {
            console.error('CONNECTION error: ',err);
            res.statusCode = 503;
              res.send({
                result: 'error',
                err:    err.code
            });
        } else {

           connection.query('SELECT * FROM user ORDER BY user_id DESC LIMIT 20', req.params.id, function(err, rows, fields) {
                if (err) {
                    console.error(err);
                    res.statusCode = 500;
                    res.send({
                        result: 'error',
                        err:    err.code
                    });
                }


                res.send({
                    result: 'success',
                    err:    '',
                    json:   rows
                });
                connection.release();
            });
        }
    });


});
请告知


谢谢

我想问题出在无法连接mysql数据库的主机上。我通过将主机配置添加到我的主机文件来解决这个问题。即使运行任何aws实例,也应将域名配置为主机文件。以便在应用程序配置中自动查找到所需的IP地址

127.0.0.1     localhost
127.0.0.1     yourdomain.com
重新启动apache


它对我有用。试试这个&让我知道。

您是否尝试使用mysql命令行客户端从节点计算机连接到服务器。。。或者使用
nc
甚至
telnet
——验证简单网络连接的东西?是的,如果我通过SSH或MSQL workbench连接到mysql服务器,效果很好`只是不在节点中工作。好的,但是从机器运行节点执行命令
nc dev-db.xxxxxx.us-west-2.rds.amazonaws.com 3306
返回预期的垃圾字符串,如
N 5.6.19-logxxxwRrf,fzpxxhuqx)a-[ca?Rmysql_native_password
?或
telnet dev-db.xxxxxx.us-west-2.rds.amazonaws.com 3306
甚至
cat
?这些东西中的任何东西都可以用来测试连接。我尝试了
nc-db.xxxxxx.us-west-2.rds.amazonaws.com 3306
命令,这就是respon我收到的se
nc:connect to dev-db.xxxxxxxx.us-west-2.rds.amazonaws.com端口3306(tcp)失败:连接超时
OMG!!经过几天的头痛,我终于明白了。我让我的aws ec2实例安全组从我的ip而不是ec2 ip接收流量。感谢上帝!!非常感谢你的帮助@Michael sqlbot