How can I connect to local SQL Server if MSSQLSERVER service is missing?

这一生的挚爱 提交于 2019-12-23 04:44:00

问题


I am trying to do some local development on various toy projects for learning purposes. I have Microsoft SQL Server Management Studio 2008 R2 (10.50.1617.0) and Visual Studio Express 2013 for Web installed on my machine. Projects using things such as Membership and Entity Framework code-first approach are failing to create databases. SSMS is configured to make connections to an external server with a bunch of my company's DBs on it, but I cannot connect to the local machine's SQL Server instance, which might be because it doesn't exist.

There is definitely no MSSQLSERVER service listed in the services list, which I assumed meant no instance of SQL Server was installed locally (even though I assumed VS 2013 or SSMS would have installed MSSQLSERVER?). This led me to download a copy of SQL Server 2012 Express LocalDB, but when I tried to install it, it failed, giving the following error:

Installation of SQL Server 2012 Express LocalDB failed because a higher version already exists on the machine. To proceed, uninstall the higher version and then run SQL Server 2012 Express LocalDB Setup again.

So I guess my question is, do I really have SQL Server installed? If so, how do I start the service (which is not even appearing in the services list) so that I can connect to it locally?


回答1:


Install Sql Server Express (free) edition (where the sql-server-express version matches your SSMS version).

http://www.microsoft.com/en-us/download/details.aspx?id=25174

I name my "instance" something besides "Express" or "SqlExpress" to avoid future complications.

MyComputerName\SqlExpress2008R2




回答2:


If SQLExpress LocalDB is already installed (and it sounds like it is) all you need to do is supply an appropriate connection string:

Fx: "Server=(LocalDB)\v11.0; Integrated Security=True;"

For other variations and a discussion of the subject check What is the connection string for localdb for version 11

Personally I would uninstall any old SQL Server product editions, then any new ones, and ultimately re-install SQL Server 2012 from this URL: http://www.microsoft.com/en-us/download/details.aspx?id=29062

This will ensure you have an up to date development environment, 2008 R2 is pretty dated and it sounds like you have some side-by-side installation of SQL2k12 and SQL2k8 components, seems a little dirty. The SQL Server 2012 Express download page will offer you access to the latest versions of SSMS, x64 editions as well as "full" editions (e.g. full-text search, SSIS, etc.)

Most people install 2008 editions because they don't know how to locate SQL Server 2012 Express, which is a little strange. Probably due to Web PI not being updated for so long.



来源:https://stackoverflow.com/questions/21733302/how-can-i-connect-to-local-sql-server-if-mssqlserver-service-is-missing

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