I have setup two configuration for migration one is for SQL server and another is for MySql. SQL Server migration is now not being used. Now my problem is when I execute Sql Server migration with Update-Database -ConfigurationTypeName InTouchEnterprise.Data.Repository.MySqlMigrations.Configuration -verbose
. It gives me following error
Authentication to host 'localhost' for user 'test' using method 'mysql_native_password' failed with message: Access denied for user 'test'@'localhost' (using password: NO)
But If I run the project it gets successfully connected to the database and do all the operation with database correctly. Now I am clue less what could have been wrong.
According to the error message it says that I am not specifying the password but I have specified password in the web.config. below is my connection string.
<add name="IdentityDB" providerName="MySql.Data.MySqlClient"
connectionString="server=localhost;port=3306;database=rtd;uid=test;password=*******" />
Below is code for Configuration class:
internal sealed class Configuration : DbMigrationsConfiguration<InTouchEnterprise.Data.Repository.InTouchEnterpriseDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
MigrationsDirectory = @"MySqlMigrations";
//for mysql
SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
}
protected override void Seed(InTouchEnterprise.Data.Repository.InTouchEnterpriseDbContext context)
{
}
}
connectionString="Server=localhost;Port=3306;Database=rtd;Uid=myUsername;Pwd=myPassword;"
I think it's the connection string format that is invalid.