DESC
按照官方文档,pm2+nginx已部署成功,就是在连接mysql的时候出错。pm2 log输出日志如下:
0|MinecraftApp | Sat, 18 May 2019 06:56:42 GMT logic deprecated logic's __after method is deprecated, it will be discarded in the next version at node_modules/koa-compose/index.js:42:32
0|MinecraftApp | { Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)
0|MinecraftApp | at Handshake.Sequence._packetToError (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
0|MinecraftApp | at Handshake.ErrorPacket (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
0|MinecraftApp | at Protocol._parsePacket (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/Protocol.js:291:23)
0|MinecraftApp | at Parser._parsePacket (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/Parser.js:433:10)
0|MinecraftApp | at Parser.write (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/Parser.js:43:10)
0|MinecraftApp | at Protocol.write (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/Protocol.js:38:16)
0|MinecraftApp | at Socket. (/var/www/MinecraftApp/node_modules/mysql/lib/Connection.js:91:28)
0|MinecraftApp | at Socket. (/var/www/MinecraftApp/node_modules/mysql/lib/Connection.js:525:10)
0|MinecraftApp | at emitOne (events.js:116:13)
0|MinecraftApp | at Socket.emit (events.js:211:7)
0|MinecraftApp | --------------------
0|MinecraftApp | at Protocol._enqueue (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/Protocol.js:144:48)
0|MinecraftApp | at Protocol.handshake (/var/www/MinecraftApp/node_modules/mysql/lib/protocol/Protocol.js:51:23)
0|MinecraftApp | at PoolConnection.connect (/var/www/MinecraftApp/node_modules/mysql/lib/Connection.js:119:18)
0|MinecraftApp | at Pool.getConnection (/var/www/MinecraftApp/node_modules/mysql/lib/Pool.js:48:16)
0|MinecraftApp | at Promise (/var/www/MinecraftApp/node_modules/think-helper/index.js:83:10)
0|MinecraftApp | at new Promise ()
0|MinecraftApp | at args (/var/www/MinecraftApp/node_modules/think-helper/index.js:82:12)
0|MinecraftApp | at ThinkMysql.getConnection (/var/www/MinecraftApp/node_modules/think-mysql/index.js:73:73)
0|MinecraftApp | at debounceInstance.debounce (/var/www/MinecraftApp/node_modules/think-mysql/index.js:225:21)
0|MinecraftApp | at Promise.resolve.then (/var/www/MinecraftApp/node_modules/think-debounce/index.js:19:16)
0|MinecraftApp | code: 'ER_ACCESS_DENIED_ERROR',
0|MinecraftApp | errno: 1045,
0|MinecraftApp | sqlMessage: 'Access denied for user 'root'@'localhost' (using password: YES)',
0|MinecraftApp | sqlState: '28000',
0|MinecraftApp | fatal: true } { request:
0|MinecraftApp | { method: 'GET',
0|MinecraftApp | url: '/user/index',
0|MinecraftApp | header:
0|MinecraftApp | { 'x-real-ip': '180.171.171.254',
0|MinecraftApp | 'x-forwarded-for': '180.171.171.254',
0|MinecraftApp | host: 'www.lvci.cc',
0|MinecraftApp | 'x-nginx-proxy': 'true',
0|MinecraftApp | connection: 'upgrade',
0|MinecraftApp | 'cache-control': 'max-age=0',
0|MinecraftApp | 'upgrade-insecure-requests': '1',
0|MinecraftApp | 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36',
0|MinecraftApp | dnt: '1',
0|MinecraftApp | accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3',
0|MinecraftApp | 'accept-encoding': 'gzip, deflate, br',
0|MinecraftApp | 'accept-language': 'zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7' } },
0|MinecraftApp | response:
0|MinecraftApp | { status: 200,
0|MinecraftApp | message: 'OK',
0|MinecraftApp | header: { 'x-powered-by': 'thinkjs-3.2.10' } },
0|MinecraftApp | app: { subdomainOffset: 2, proxy: true, env: 'production' },
0|MinecraftApp | originalUrl: '/user/index',
0|MinecraftApp | req: '',
0|MinecraftApp | res: '',
0|MinecraftApp | socket: '' }
其中,配置文件mysql的用户和密码确定没错,默认3306端口也没被占用。
ENV
OS Platform:
centOS 6
Node.js Version:
v8.16.0
ThinkJS Version:
code
// your code here
error message
// your error message here
more description
// your detail description