Unable to connect to mysql - SQLSTATE[HY000] [2002] No such file or directory

Hello,

I’m trying out CircleCI for the first time as a part of my pet-/playground-project with Symfony4 plus as a part of the project I’m also creating my own circleci primary docker image.

I have a couple of basic unit tests which all run perfectly on localhost but when I try to run the workflow it fails when trying to migrate the test database with a “SQLSTATE[HY000] [2002] No such file or directory” error.

I’ve googled a bit and found many posts with this error but not many solutions; the one which suggested to apt-get mysql-client among some other tweaks (discuss[dot]circleci[dot]com/t/unable-to-connect-to-mysql-5-7-and-create-database/29941/6) sounded the most promising but unfortunately also failed with the same error.

What am I missing in my config file:


or in my primary docker image:
https://github.com/jwwisniewski/circleic-primary/blob/master/Dockerfile ?

I’d be grateful for any suggestions.

Thanks,
Jakub

This is, well… kind of surprising and unexpected but changing
DATABASE_URL: "mysql://test:test@localhost:3306/test"
to
DATABASE_URL: "mysql://test:test@127.0.0.1:3306/test"
solved the issue