{ domain: null, _events: {}, _maxListeners: undefined, config: { host: ‘localhost’, port: ‘3306’, localAddress: undefined, socketPath: undefined, user: ‘root’, password: ‘root123’, database: ‘my_news_test’, connectTimeout: 10000, insecureAuth: false, supportBigNumbers: false, bigNumberStrings: false, dateStrings: false, debug: undefined, trace: true, stringifyObjects: false, timezone: ‘local’, flags: ‘’, queryFormat: undefined, pool: undefined, ssl: false, multipleStatements: false, typeCast: true, maxPacketSize: 0, charsetNumber: 33, clientFlags: 455631 }, _socket: undefined, _protocol: { domain: null, _events: {}, _maxListeners: undefined, readable: true, writable: true, _config: { host: ‘localhost’, port: ‘3306’, localAddress: undefined, socketPath: undefined, user: ‘root’, password: ‘root123’, database: ‘my_news_test’, connectTimeout: 10000, insecureAuth: false, supportBigNumbers: false, bigNumberStrings: false, dateStrings: false, debug: undefined, trace: true, stringifyObjects: false, timezone: ‘local’, flags: ‘’, queryFormat: undefined, pool: undefined, ssl: false, multipleStatements: false, typeCast: true, maxPacketSize: 0, charsetNumber: 33, clientFlags: 455631 }, _connection: [Circular], _callback: null, _fatalError: null, _quitSequence: null, _handshakeSequence: null, _handshaked: false, _ended: false, _destroyed: false, _queue: [], _handshakeInitializationPacket: null, _parser: { _supportBigNumbers: false, _buffer: <Buffer >, _longPacketBuffers: [], _offset: 0, _packetEnd: null, _packetHeader: null, _packetOffset: null, _onError: [Function], _onPacket: [Function], _nextPacketNumber: 0, _encoding: ‘utf-8’, _paused: false } }, _connectCalled: false, state: ‘disconnected’, threadId: null } events.js:85 throw er; // Unhandled ‘error’ event ^ Error: connect ECONNREFUSED at exports._errnoException (util.js:746:11) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:983:19) -------------------- at Protocol._enqueue (/Users/ssss/ds/node_modules/mysql/lib/protocol/Protocol.js:135:48) at Protocol.handshake (/Users/ssss/ds/node_modules/mysql/lib/protocol/Protocol.js:52:41) at Connection.connect (/Users/ssss/ds/node_modules/mysql/lib/Connection.js:123:18) at Connection._implyConnect (/Users/ssss/ds/node_modules/mysql/lib/Connection.js:417:10) at Connection.end (/Users/ssss/ds/node_modules/mysql/lib/Connection.js:241:8) at Object.<anonymous> (/Users/ssss/ds/test.js:24:12) at Module._compile (module.js:460:26) at Object.Module._extensions…js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) 不知道为什么 望大神赐教!良辰先有礼了!
看起来像是数据库连接失败,排查下存储服务以及驱动问题
@haozxuan mongo 都没问题哦 本地的 应该不是这些的原因 是不是 还要打开啥?? 就和mongo一样要先启动mongo?
代码建议格式化先~贴一下链接mysql代码
@enternull 连接数据库当然要保证服务启动,你不会没有启动mysql服务吧?
@haozxuan 这个错误明显就是端口没有打开或无法连接到该端口……九成九就是没开MySQL……
@haozxuan 启动了的·! 但是- - 启动 貌似报错了·!