title: Cannot connect to MySQL service in MySQL docker container?
body: <p>So, I've got a MySQL docker container on which I run a script to write into the database, but when I execute the script, my script throws</p>
  <pre><code>mysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
  </code></pre>
  <p>Do I have to start the MySQL service in the Dockerfile?</p>
  <p>docker-compose.yml:</p>
  <pre><code>version: '3.3'
  
  services:
    db:
      build: .
      restart: always
      environment: 
        MYSQL_ROOT_PASSWORD: test
        MYSQL_DATABASE: test
        MYSQL_USER: test
        MYSQL_PASSWORD: test
      volumes: 
        - ./db_data:/docker-entrypoint-initdb.d
  </code></pre>