Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyword not supported: 'userid' error

I have cloned this source code (https://code.msdn.microsoft.com/Onion-Architecture-In-9c58c06d). I am using mysql and my connection string

  "ConnectionStrings": {
    "DefaultConnection": "server=localhost;userid=root;pwd=root;port=3306;database=ddd;sslmode=none;"
  },

In my package manager console command Add-Migration FirstMigration was successful however, Update-Database is throwing me

System.ArgumentException: Keyword not supported: 'userid'.
   at System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms)
   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerConnection.CreateDbConnection()
   at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_1.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Keyword not supported: 'userid'.

Am I doing something wrong?

like image 870
Thinker Avatar asked Dec 24 '22 07:12

Thinker


1 Answers

That's not a valid connection string for SQL Server. userid should be User ID and pwd should be Password. For example

Server=servername\instancename;Database=dbname;User Id=username;Password=password;

For more examples see: https://www.connectionstrings.com/sql-server/

like image 98
Henk Mollema Avatar answered Jan 15 '23 21:01

Henk Mollema