jworkman / ASL-Knowledge-Base

Centralized knowledge base for students in Advanced Server-side Languages.
1 stars 1 forks source link

Request for assistance: ECONNREFUSED 127.0.0.1:3306 #3

Closed BurgosCoralis-FS closed 8 months ago

BurgosCoralis-FS commented 8 months ago

Issue Description

When attempting to run a squelize command like npx sequelize-cli db:seed:all or npx sequelize-cli db:migrate:undo:all it returns an error that indicates that the connection was refused.

Full Error Backtrace

Terminal: ERROR: connect ECONNREFUSED 127.0.0.1:3306 I tried to look for any errors inside the mysql server but there were none.

Screenshots

Screenshot 2024-01-31 at 12 32 47 PM

Any Other Notes

Followed the steps from the Advanced Express Activity Lesson until 1:17:00 where it requires to initiate seeders.

While looking into other issues, I noticed how they were getting a more extensive and detailed error message. This issue was the one with my same output but it isn't solved. ERROR: connect ECONNREFUSED 127.0.0.1:3306 #13364

Other visited forums: SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306 Encountering an ECONNREFUSED error for 127.0.0.1:3306 while launching a node.js application Migrations won't run with Postgres Dialect Specified #382

Other possible solutions that I tried:

I'm currently thinking of starting the project again from 0 but if there's a way I can avoid that it will be greatly appreciated. Thanks.

BurgosCoralis-FS commented 8 months ago

I can't believe I spent an entire day without noticing that I was inputting the command in the wrong file location...

jworkman commented 8 months ago

Glad to hear you figured out what the issue was. And thank you for requesting a ticket. This will help any future students with this same issue.

jworkman commented 8 months ago

And FYI to any students encountering this same issue: this error can be encountered if your attempting to run a sequelize-cli command in the wrong directory inside your docker container. For example if you stuck all of your model, migrations, and config directories inside src/ then you need to change directory inside src/ before running any sequelize commands.