Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

saurabh pathak
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 19, 2018

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

Rodrigo Chaves
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2019

This resolved my problems too. Thank you!

Abhishek_Jakhotiya
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 11, 2019

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

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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