Cannot open database requested by the login. The login failed. Login failed for user

前端 未结 1 1728
轮回少年
轮回少年 2021-01-13 10:44

I have copied a DB from one my computers and using it here. On trying to open the page which requires the fetching content from DB, on con.open I am getting this exception:<

相关标签:
1条回答
  • 2021-01-13 11:19

    There are users of the database, but, there are also users of the server. One user has to have login rights to SqlServer before it can use the database.

    In your case you copied the database and it's users, but those users don't have login permissions on the new server. Solution would be to add a new Login account on SqlServer (go to the Security node of the SqlServer, not the Security node of the database), and add it there. When you add that user, assign it to the database as well, and that should work.

    Edit: After reading your issue further, is it possible that there are two sql servers targeting the same mdf file? Because that cannot work. Also, when copying database files, have you detached them before copying? If that's all fine, then try making backup and then restore.

    0 讨论(0)
提交回复
热议问题