Unable to connect MYSQL database in host machine from docker container

0

I have deployed a .net application as docker container which is trying to connect to mysql database placed in host machine. This is the error I am getting when i am running the container

MySql.Data.MySqlClient.MySqlException (0x80004005): Host 'host.docker.internal' is not allowed to connect to this MySQL
server
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at NetworkBridge.Program.MySql(String server, String database) in C:\src\Program.cs:line 91
All done. Press any key to finish...

I have tried many solution over google,but nothing works for me!

c#
mysql
database
windows
docker
asked on Stack Overflow Jun 16, 2020 by Arshit Singh • edited Jun 16, 2020 by Arshit Singh

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0