Skip to content

Prisma can not connect to localhost for MySQL, MariaDB and SQL Server (mostly when running those via Docker) #5499

@janpio

Description

@janpio

Recently our own CI (Github Actions based) pipelines started failing with the following error:

P1001

Can't reach database server at `localhost`:`3306`

Please make sure your database server is running at `localhost`:`3306`.

Before this started to appear, we did not change any related code or how we run our tests or databases. It just started happening by itself 👻

A few users started reporting the same or very similar errors in our public Slack as well.

Upon investigation, we could confirm that the exact same code that succeeded on CI a few days ago, did not any more now. Upon inquiry, users confirmed that their projects "just stopped working".


We could fortunately pinpoint the problem only to MySQL, MariaDB and SQL Server databases running via Docker and being accessed via a connection string with the hostname localhost.

⚠️ Replacing localhost with 127.0.0.1 fixed the problem and is a valid workaround. ⚠️

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions