Django on docker container error when trying to connect to local mysql database

Please help me,

I have django application that run on docker container with docker-compose, but i have error when trying to connect to mysql database on my local machine.

The error message is like this : Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

my docker-compose.yml file is like this :

 version: '3'

 services:
   web:
     container_name: web
     build: .
     command: python manage.py runserver 0.0.0.0:8000
     volumes:
       - .:/code
     ports:
       - "8000:8000"

and my Dockerfile is like this :

FROM python:3

ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY . /code/
RUN apt-get update
RUN apt-get install python3-dev default-libmysqlclient-dev -y
RUN pip install pip -U
RUN pip install -r requirements.txt

Source: StackOverflow