How to connect to a local database in SQL Server Management Studio?

こ雲淡風輕ζ 提交于 2019-12-08 22:48:13

问题


I have downloaded the SQL Server Management Studio (SSMS) 2016 to recover a huge .bak file which is an old backup of a database. But first of all I need to connect to a DB Server.

After install, I execute SSMS and it asks me to connect to a DB Server. I don't have any and I saw that it is possible to create a "local" db by typing only a dot '.' for Server Name and use Windows authentication.

It is not working; how to do it?


回答1:


You need to download and install SQL LocalDB. It is a special edition of SQL Server that does not allow remote connection and supports windows integrated authentication only. It is a simple one click MSI install so it is easy to deploy.

To download and install SQL Server 2016 Express, go to SQL Server downloads. LocalDB is a feature you select during installation, and is available when you download the media. If you download the media, either choose Express Advanced or the LocalDB package.

The above means that now you have to download and run a small downloader (cca 5 MB), select LocalDB (44 MB) and the Microsoft downloader will download MSI package to the folder you select. Then just run MSI package and LocalDB gets installed.




回答2:


Open SSMS -> Connect, and for the server name type: (LocalDb)\MSSQLLocalDB, and choose Windows Authentication.

For a reference:




回答3:


To recover your Dump, you need one server where your dump will get uploaded. For this you need one MS server. you can connect to server using username and password. After connection to server you can create a DB in which you want the dump to get imported.

If your SQL dump contains create Database statement, then you don't need to create one.

If its possible to open SQL dump in text file, you can see Database name required to create or its already have statement to create DB.



来源:https://stackoverflow.com/questions/43257209/how-to-connect-to-a-local-database-in-sql-server-management-studio

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