Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't connect to local MySQL server through socket in bitbucket pipelines

saurabh pathak June 10, 2017

My bitbucket-pipelines.yml file is showing a error :"_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")".


pipelines: default: - step: image: python:3.5.2 services: - database script: - pip install -r requirements.txt - python manage.py run_test definitions: services: database: image: mysql environment: MYSQL_DATABASE: 'pipelines' MYSQL_ROOT_PASSWORD: 'let_me_in'

Above is my code.Thanks in advance 

2 answers

2 votes
Allan Daly December 15, 2017

I ran into this problem. For me the fix was to use '0.0.0.0' instead of 'localhost' in Django as the database HOST. The Atlassian docs clearly state to use localhost, so I believe they are wrong.

Florian Flock January 19, 2018

Yes, this is definitely a the fix. Maybe they are wrong in the docker network setup of the pipeline.

Rodrigo Chaves January 18, 2019

This resolved my problems too. Thank you!

Abhishek_Jakhotiya July 11, 2019

This worked for me too! Atlassian should really fix their docs

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2017

The usual reasons for that error are that MySQL is not running, or it is configured with a different socket file.  Check your my.cnf for it.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events