✅ Cannot connect to mysql docker container db from AspNet Core App
A AspNet Core App using EF-Core cannot connect to local db container running mysql. I have made sure it forwards the correct port (default 3306). ASet my connection string in my app to:
So why doesnt it work? I alsot ried setting server to localhost and 127.0.0.1 ....
13 Replies
can you show the docker command or compose that started the mysql container?
also, is that asp.net app itself running in docker?
(actually, answer question #2 first)
No my app is runnig on host machine while my mysql server is running on a docker container on my host.
i tried creating a standalone app with the same connection string and connecting, it worked after creating the database manually in the docker container.
But then trying from
Update Database
doesnt work and gives this error:
@beware of the leoparduh, that error seems to be for MS SQL Server
but your initial message said MySQL
@Tiltyboi
Is that not the same `?
no
Sorry i dont know .NET very well
so which database are you intending to use?
Well i want to use mysql becuase i have experience in it
but my image is
mysql:latest
Database Providers - EF Core
Information about specific supported Entity Framework Core providers and about providers in general
Ah that worked! Thanks so much! @beware of the leopard :prayge: Have a good day/evening
$close
If you have no further questions, please use /close to mark the forum thread as answered
np