已排查端口为3306
寻找解决方法的过程中,有如下说法:
在配置里加上 socketPath: '/var/run/mysqld/mysqld.sock’
https://stackoverflow.com/questions/30266221/node-js-mysql-error-connect-econnrefused
但是官方的文档里说:在有host和port的情况下,socketPath会被忽略。。。
请老师和各位同学指点迷津!
具体的错误信息如下:
{ Error: connect ECONNREFUSED 127.0.0.1:3306
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
--------------------
at Protocol._enqueue (/Users/jiexinglu/Desktop/Node Blog Server/mysql-test/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/Users/jiexinglu/Desktop/Node Blog Server/mysql-test/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at Connection.connect (/Users/jiexinglu/Desktop/Node Blog Server/mysql-test/node_modules/mysql/lib/Connection.js:119:18)
at Object. (/Users/jiexinglu/Desktop/Node Blog Server/mysql-test/index.js:13:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
code: ‘ECONNREFUSED’,
errno: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘127.0.0.1’,
port: 3306,
fatal: true }