Applications within docker cannot connect to mysql

I installed mysql inside docker and can be used in mac. Host is 127.0.0.1
after I put my node application on docker using docker"s build command, host reported the following error

whether it was 127.0.0.1 or 0.0.0.0
connect ECONNREFUSED 0.0.0.0:3306

at Protocol.Object.<anonymous>.Protocol._enqueue (node_modules/mysql/lib/protocol/Protocol.js:144:48)
      at Protocol.handshake (node_modules/mysql/lib/protocol/Protocol.js:51:23)
      at Connection.connect (node_modules/mysql/lib/Connection.js:118:18)
      at new connect (sdk.js:23:29)
      at Object.test (sdk.test.js:44:24)
Apr.14,2022

because node is in container and mysql is also in container, these two are not a container (which can be roughly understood as not running on a machine), so the host of mysql in the node code is not the local network 127.0.0.1, but the hostname specified to mysql in the compose file.


when I use docker-compose, I fill in the service name corresponding to docker-compose.yml mysql56

inside the code.
version: "3"
services:
  mysql56:
    image: mysql:5.6
    ports:
      - 3306:3306
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b365df-2b786.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b365df-2b786.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?