Lost connection to MySQL server at 'handshake: reading initial communication packet', system error: 104

Viewed 547

Hi I'm trying to run my Django applications with docker but when I run docker-compose up it gives me the error.

Lost connection to MySQL server at 'handshake: reading initial communication packet', system error: 104

Here is my docker-compose.yml

version: '3'

services:
db:
  image: mysql:5.7
  ports:
    - '3306:3306'
  environment:
     MYSQL_DATABASE: 'my_app'
     MYSQL_USER: 'root'
     MYSQL_PASSWORD: 'password'
     MYSQL_ROOT_PASSWORD: 'password'
  volumes:
    - /tmp/app/mysqld:/var/run/mysqld
    - ./db:/var/lib/mysql
web:
  build: .
  command: python manage.py runserver 0.0.0.0:8000
  volumes:
    - .:/vvouch
    - /tmp/app/mysqld:/var/run/mysqld
  ports:
    - "8000:8000"
  depends_on:
    - db

I tried to even with different port and also I removed ports from docker-compose.yml file but it gives the same error. Anyone can please help me thanks in advance.

0 Answers
Related