使用节点连接到localhost时拒绝访问

时间:2017-09-22 03:20:17

标签: mysql node.js xampp localhost npm-start

当我尝试使用node(npm start)启动代码时出错。 我安装了MySQL,XAMPP和节点。 错误如下:

webpack building...
Server started on port 3000
/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Parser.js:80
        throw err; // Rethrow non-MySQL errors
        ^

Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: NO)
    at Handshake.Sequence._packetToError (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
    at Handshake.ErrorPacket (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/sequences/Handshake.js:103:18)
    at Protocol._parsePacket (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/Connection.js:103:28)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:266:12)
    at readableAddChunk (_stream_readable.js:253:11)
    at Socket.Readable.push (_stream_readable.js:211:10)
    at TCP.onread (net.js:585:20)
    --------------------
    at Protocol._enqueue (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Protocol.handshake (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:52:23)
    at PoolConnection.connect (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/Connection.js:130:18)
    at Pool.getConnection (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/Pool.js:48:16)
    at Object.<anonymous> (/Users/RaphaelleG/Documents/SOEN343/server/config/database.js:14:6)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/RaphaelleG/Documents/SOEN343/server/app.js:18:16)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tecmarket@0.1.0 start: `node ./server/app.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the tecmarket@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/RaphaelleG/.npm/_logs/2017-09-22T03_16_49_509Z-debug.log

请你能帮我解决这个错误吗?

0 个答案:

没有答案