Use node JS database module MySQL
, connection database query error
Error: connect ECONNREFUSED ::1:3306
reason
I annotated the mapping relationship of /ECT/hosts
# 127.0.0.1 localhost
The original configuration used localhost
, so the database could not be connected suddenly
{
host: 'localhost',
user: 'root',
password: '123456',
database: 'data',
};
Treatment method
Method 1:
Change the mapping relationship of /ECT/hosts
# 127.0.0.1 localhost
127.0.0.1 localhost
Method 2:
You can use 127.0.0.1
instead
{
// host: 'localhost',
host: '127.0.0.1',
user: 'root',
password: '123456',
database: 'data',
};
Read More:
- node.js yarn Error: SyntaxError: Unexpected string [How to Solve]
- [Solved] Node.js v17 npm run dev Error: opensslErrorStack
- [Solved] node.js Upload Files Error: Multipart: boundary not found multer
- Node.js Error: Cannot find module express [How to Solve]
- [Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
- Node.js Error: Error: Cannot find module ‘express‘ [How to Solve]
- Node.js Error: “Error: EBUSY: resource busy or locked, stat“
- [Solved] node.js request Error: Error: unable to verify the first certificate
- [Solved] This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/_@babel_runtim
- [Solved] Error: ENOENT: no such file or directory, scandir ‘..\node_modules\node-sass\vendor‘
- [Solved] Nuxt Import qrcodejs2.js / QRCode.js Error: document is not defined
- [Solved] error C:\Users\HP\Desktop\VueProject\vue_cli\node_modules\node-sass: Command failed.Exit code: 1
- Solution to some map files in JS folder after Vue packaging (remove the map. JS file)
- Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs)
- [Solved] webpack Package Error: ERROR in multi ./src/main.js ./dist/bundle.js Module not found: Error: Can‘t resolv
- [Solved] error: mongoosserverselectionerror: connect econnreused 127.0 0.1:27017
- How to Solve Node start error listen eacces 0.0.0.0:810
- core-js/modules/es.error.cause.js [How to Solve]
- The addition, deletion and modification of DOM in JS Foundation
- [Solved] Node sass version 7.0.0 is incompatible with ^ 4.0.0 | ^ 5.0.0 | ^ 6.0.0