如何解决egg js nodejs.PROTOCOL_SEQUENCE_TIMEOUTError: Handshake inactivity timeout 错误?
最近使用egg js的过程中,不同的电脑拉取最新代码运行后,老是提示如下错误:
mysql.js:20:7 was still unable to finish
WARN 10584 [egg:core:ready_timeout] 10 seconds later /Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/egg
-mysql/lib/mysql.js:20:7 was still unable to finish.
2019-08-04 23:04:11,959 ERROR 10584 [-/127.0.0.1/-/0ms GET /] nodejs.PROTOCOL_SEQUENCE_TIMEOUTError: Handshake inactivity timeout
at Handshake.<anonymous> (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/protocol/Protocol.js:160:17)
at Handshake.emit (events.js:197:13)
at Handshake._onTimeout (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/protocol/sequences/Sequence.js:124:8)
at Timer._onTimeout (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/protocol/Timer.js:32:23)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
--------------------
at Protocol._enqueue (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/Connection.js:119:18)
at Pool.getConnection (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/Pool.js:48:16)
at /Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/ali-rds/node_modules/pify/index.js:29:7
at new Promise (<anonymous>)
at Pool.<anonymous> (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/ali-rds/node_modules/pify/index.js:12:10)
at Pool.ret [as getConnection] (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/ali-rds/node_modules/pify/index.js:56:34)
at Pool.query (/Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/mysql/lib/Pool.js:202:8)
at /Users/acer/kuaipan/mac/git/node/yyy/xxx/src/node_modules/ali-rds/node_modules/pify/index.js:29:7
sql: select now() as currentTime;
code: "PROTOCOL_SEQUENCE_TIMEOUT"
fatal: true
timeout: 10000
name: "PROTOCOL_SEQUENCE_TIMEOUTError"
pid: 10584
出现这个错误的原因是:
- 数据库配置错误
- 数据库配置正确,但是数据库里没有相应的表。
解决如上2个问题,报错即会消失。