title: TCPConnectWrap.afterConnect - node can't get data from mysql when are in docker compose
body: <p>I'm trying to connect node with mysql through dokcer-compose. I can access mysql with workbench but when I try to connect with node I get the error:</p>
  
  <pre><code>Error: connect ECONNREFUSED 127.0.0.1:3306
       at TCPConnectWrap.afterConnect [as oncomplete] (net.js: 1054: 14))
  </code></pre>
  
  <p>Does anyone know what is going on?</p>
  
  <h3>docker-compose.yml</h3>
  
  <pre><code>version: '3'
  
  services:
  
    #App Service
    app:
      image: "node:alpine"
      container_name: cms-node
      restart: unless-stopped
      tty: true
      working_dir: /app
      environment:
        - NODE_ENV=production
      ports:
        - 1234:1234
      volumes:
        - ./:/app
      links:
        - db
      depends_on:
        - db
  
    #Mysql Service
    db:
      image: mysql:latest
      container_name: cms-mysql
      restart: unless-stopped
      # command: --default-authentication-plugin=mysql_native_password
      environment:
        MYSQL_DATABASE: CMS
        MYSQL_USER: root
        MYSQL_PASSWORD: root
        MYSQL_ROOT_PASSWORD: root
      ports:
        - 3306:3306
  </code></pre>
  
  <h3>node create connection</h3>
  
  <pre><code>const db: Connection = mysql.createConnection({
      host: 'localhost',
      user: 'root',
      password: 'root',
      database: 'CMS',
  });
  
  export default db;
  </code></pre>
  
  <h3>node try to connect</h3>
  
  <pre><code>db.connect((err) =&gt; {
              if (err) {
                  throw err;
              }
              console.log('Connected!');
          });
  </code></pre>