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:
- After Vite starts, it will prompt “network: use ` — host ` to expose”, and the service cannot be accessed through network IP
- [Solved] Temporary error: Error: spawn E:\vue3-vite\my-app\node_modules\esbuild\esbuild.exe ENOENT
- proxy error: could not proxy request [How to Solve]
- [Solved] Vue package error: Syntax Error: Error: Cannot find module ‘mozjpeg’
- [Solved] error: mongoosserverselectionerror: connect econnreused 127.0 0.1:27017
- [Solved] VUE3 Error: Error: ENOSPC: System limit for number of file watchers reached
- How to Solve Bat Script Error: system error 85 has occurred
- [Solved] Layui 404 Error: Static resources cannot load layui.js and layui. css
- [Solved] node.js Upload Files Error: Multipart: boundary not found multer
- @requestbody: How to Use or Not Use
- [Solved] Vue Error: Module build failed Error Node Sass version 6.0.1 is incompatible with ^4.0.0.
- [Solved] Yapi Secondary deploy error: xxx validation failed: mock: Path `xxx` is required
- The addition, deletion and modification of DOM in JS Foundation
- Module build failed: Error: Couldn’t find preset “es2015” relative to directory
- How to Solve Node start error listen eacces 0.0.0.0:810
- [Go]Understand the golang project performance analysis tool PProf
- [Solved] Font End Image Display Error: net::ERR_CONNECTION_RESET 431 (Request Header Fields Too Large)
- The solution to the failure of HTML introducing external JS
- [Vue error] the solution to the template root requires exactly one element error reporting
- Vue Install less Error: While resolving: [email protected]