Can't connect to my own MDF file. Cannot open user default database. Login failed.Login failed for user… and other errors

荒凉一梦 提交于 2019-12-04 11:37:41
Oleg Dok

MDF files are not intended to be used directly.

You may use them only through and with the help of SQL Server Engine.

Alejandro Castillo

Try this:

1- Create a database with the same name to mdf file.

2- Stop sql service

3- Go to the Data Carpet where is all mdf files and ldf , copy your original mdf file y replace.

4- Start the service

5- See in the management studio if the database still online there you go.

A .MDF database cannot be "opened".

It must be attached to an existing (and running) SQL Server instance.

If you have SQL Server Management Studio running, open a connection, and right click on databases. Choose "Attach" and point to the .MDF file. This will (attempt to) attach the database to the master database. If it works, the database will be visible in SSMS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!