P粉5474204742023-08-23 15:56:17
For those deploying on AWS
and encountering this error, you will need to make changes to the security group of the database/cluster, Add an inbound rule
where source
is the security group of the instance.
The inbound rules should look like this:
类型:MySQL/Aurora 协议:TCP(默认) 端口:3306(默认) 源:<实例的安全组> 描述:<可选>
P粉1551282112023-08-23 09:38:03
Okay, the timeout is from line 162 of the Protocol.js file. If you look at node-mysql, you will see that the variable queried is "timeout". If you set the timeout to a much higher value than the default of 10000, the error should go away. An example is
pool = require('mysql').createPool({ connectionLimit : 1000, connectTimeout : 60 * 60 * 1000, acquireTimeout : 60 * 60 * 1000, timeout : 60 * 60 * 1000, host : process.env.DB_HOST, user : process.env.DB_USERNAME, password : process.env.DB_PASSWORD, database : process.env.DB_DATABASE });
You can also edit the timeout in the Sequence.js file (node_modules/mysql/lib/protocol/sequences/Sequence.js)
this._timeout = 100000;