-2

I have hosting account in plesk panel. I can create and remove a database in hosting panel.

Now I want to create a database from my local computer using add-migration in code first approach. but the following error occurs:

"login failed for the user [myUserId]"

The connection string in appsettings.json is:

"CourseConnection": "Data Source = host-ip,1433; Initial Catalog=mydb;User ID=myuserid;Password=mypassword"     

There are two options to create databases on hosting panel:

localhost:3306(default for mysql)
localhost(default for MS sql v13.0...)

I think that provider name is not mentioned in connectionstring but appsettings.json works fine on my local machine without provider name: System.Data.SqlClient.

Fiaz Ahmed Ranjha
  • 245
  • 1
  • 6
  • 22
  • According to the error message, it seems that you used the wrong user myUserid. I suggest you could try to re-check you have used the right username and password. Besides, if you want to use mysql for EF core, you should use `MySql.Data.EntityFrameworkCore` .More details, you could refer to this [article](https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core-example.html). – Brando Zhang Jul 31 '20 at 08:24

1 Answers1

0

after hours of try and error , the problem solved as follows: i created the database in plesk panel and created a new user . then assign that user to the database . then in package-manager-console applied update-database command to apply migration that was already added. i used the same connection string in appsettings.json ,it worked successfully.all table created and migration applied . it may be helpful for someone. regards

Fiaz Ahmed Ranjha
  • 245
  • 1
  • 6
  • 22