Hello guys I'm not sure what is wrong with my code, but I'm having the issue with connecting to my database and querying data

42 views Asked by At
Listening...
(node:2769) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1138:16)
    --------------------
    at Protocol._enqueue (/home/shpham6/db-team-13/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/home/shpham6/db-team-13/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at Connection.connect (/home/shpham6/db-team-13/node_modules/mysql/lib/Connection.js:116:18)
    at Connection._implyConnect (/home/shpham6/db-team-13/node_modules/mysql/lib/Connection.js:454:10)
    at Connection.query (/home/shpham6/db-team-13/node_modules/mysql/lib/Connection.js:196:8)
    at internal/util.js:297:30
    at new Promise (<anonymous>)
    at Connection.query (internal/util.js:296:12)
    at Object.query (/home/shpham6/db-team-13/core/DBConnection.js:22:6)
    at Object.exports.getCustomerFromUsername (/home/shpham6/db-team-13/core/CustomerAuthDB.js:110:35)
(node:2769) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2769) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2769) UnhandledPromiseRejectionWarning: Error: Cannot enqueue Query after fatal error.
    at Protocol._validateEnqueue (/home/shpham6/db-team-13/node_modules/mysql/lib/protocol/Protocol.js:212:16)
    at Protocol._enqueue (/home/shpham6/db-team-13/node_modules/mysql/lib/protocol/Protocol.js:138:13)
    at Connection.query (/home/shpham6/db-team-13/node_modules/mysql/lib/Connection.js:198:25)
    at internal/util.js:297:30
    at new Promise (<anonymous>)
    at Connection.query (internal/util.js:296:12)
    at Object.query (/home/shpham6/db-team-13/core/DBConnection.js:22:6)
    at Object.exports.getCustomerFromUsername (/home/shpham6/db-team-13/core/CustomerAuthDB.js:110:35)
    at Object.exports.createCustomer (/home/shpham6/db-team-13/core/CustomerAuthDB.js:119:20)
    at Object.exports.post [as /api/auth/customer/create-account] (/home/shpham6/db-team-13/api/auth/customer/create-account.js:4:32)
(node:2769) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

I've looked everywhere and changed my db-connection-info.js to have the "host" : "127.0.0.1" but this didn't help at all. I also tried to reinstall mysql hoping that this may solve any connection issues, since it was working before messing with the mysql database.

0

There are 0 answers