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.
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