In the goal to use asp.net core mvc with the mysql database , i have downloaded the specific provider of EF_Core for Mysql.
Then i registred the DbContext service in the startup file:
services.AddDbContext<NawrasContext>(options=>
options.UseMySql(Configuration.GetConnectionString("DefaultConnection")));
and this is my appsettings.json :
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=s.mysql.db;Database=s2019;Uid=s2019;Pwd=pass;"
}
}
I have successfully added my first migration , but when i try to update the database , i get this error :
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
An error occurred using the connection to database '' on server 's.mysql.db'.
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer, IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 440
what i m doing wrong ? why the error is telling me :
An error occurred using the connection to database '' on server 's.mysql.db'. while the name of the database in the connection string is specified ?