LondheShubham153 / two-tier-flask-app

117 stars 1.29k forks source link

Operation Error while connecting flask app to mysql #16

Open Bilal05476 opened 11 months ago

Bilal05476 commented 11 months ago

OperationalError MySQLdb.OperationalError: (2002, "Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)")

Screenshot from 2023-10-07 17-08-11

Both containers in same network but above error persist

sitchatt commented 11 months ago

Hi, can you tell me more about your other configuration too? What is the MySQL port you selected?

Sudarshankevat commented 6 months ago

Hi, can you tell me more about your other configuration too? What is the MySQL port you selected? port no : 3306

pratiksha-design261 commented 1 month ago

Use the below code for docker-compose.yml it will fix above error : version: '3.9' services:

flask-app: container_name: 'flask-python-application' build: context: . ports:

volumes: mysql-volume-data: