Docker - SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306
Insteaf of localhost
point to mysql
which is the service name (DNS) that nodejs will resolve into the MySQL container:
DB_HOSTNAME: mysql
And
{ ... host: 'mysql', ... }
Inside of the container you should reference the container by the name you gave in your docker-compose.yml
file.
In this case you should use
DB_HOSTNAME: mysql
use your connection string as :mysql://username:password@mysql:(port_running_on_container)or(exposed_port)/db_name