简体   繁体   English

连接到 SQL Server Express - 我的服务器名称是什么?

[英]Connecting to SQL Server Express - What is my server name?

I was just given a laptop to perform some development from a client and I am currently in the process of setting it up.我刚从客户那里得到一台笔记本电脑来执行一些开发,我目前正在设置它。 Visual Studio 2010 is installed as well as SQL Server Management Studio 2008 R2.安装了 Visual Studio 2010 以及 SQL Server Management Studio 2008 R2。 I'm trying to open SQL Server Management Studio to connect to the database but so far am not having much luck.我正在尝试打开 SQL Server Management Studio 以连接到数据库,但到目前为止运气不佳。 I'm used typing in for a server name something like...我习惯于输入服务器名称,例如...

localhost
(local)
SQLEXPRESS

Instead of giving:而不是给予:

./SQLEXPRESS //in the Server Name

I put this:我把这个:

.\SQLEXPRESS //which solved my problem

You should be able to see it in the Services panel.您应该能够在“服务”面板中看到它。 Look for a servicename like Sql Server (MSSQLSERVER) .寻找像Sql Server (MSSQLSERVER) The name in the parentheses is your instance name.括号中的名称是您的实例名称。

If sql server is installed on your machine, you should check如果您的机器上安装了 sql server,您应该检查

Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Services You'll see "SQL Server (MSSQLSERVER)" Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Services 你会看到“SQL Server (MSSQLSERVER)”

Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for MSSQLSERVER -> TCP/IP Make sure it's using port number 1433程序 -> Microsoft SQL Server 20XX -> 配置工具 -> SQL Server 配置管理器 -> SQL Server 网络配置 -> MSSQLSERVER 协议 -> TCP/IP 确保它使用端口号 1433

If you want to see if the port is open and listening try this from your command prompt... telnet 127.0.0.1 1433如果您想查看端口是否打开并正在侦听,请从命令提示符尝试此操作... telnet 127.0.0.1 1433

And yes, SQL Express installs use localhost\\SQLEXPRESS as the instance name by default.是的,SQL Express 安装默认使用 localhost\\SQLEXPRESS 作为实例名称。

Sometimes none of these would work for me.有时这些都不适合我。 So I used to create a new web project in VS and select Authorization as "Individual User Accounts".所以我以前在VS中新建了一个web项目,选择授权为“个人用户账户”。 I believe this work with some higher version of .NET Framework or something.我相信这适用于某些更高版本的 .NET Framework 或其他东西。 But when you do this it will have your connection details.但是当你这样做时,它会有你的连接详细信息。 Mostly something like this主要是这样的

(LocalDb)\MSSQLLocalDB

by default -默认情况下 -

you can also log in to sql express using server name as:您还可以使用服务器名称登录到 sql express:

./SQLEXPRESS

or log in to sql server simply as或者简单地登录到 sql server

.

This was provided after installation of Sql Express 2019这是在安装 Sql Express 2019 后提供的

Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;

So just use 'localhost\\SQLEXPRESS' in server name and windows authentication worked for me.因此,只需在服务器名称中使用“localhost\\SQLEXPRESS”,Windows 身份验证就对我有用。

在此处输入图片说明

Similar to what StuartLC was saying, my problem was not resolved until I enabled TCP/IP protocol under SQL Network Configuration >> Protocols for MSSQLSERVER in the SQL Server Configuration Manager dialogue box.与 StuartLC 所说的类似,直到我在SQL Server Configuration Manager对话框中的SQL Network Configuration >> Protocols for MSSQLSERVER下启用 TCP/IP 协议后,我的问题才得到解决。 After enabling this and a restart, my SSMS connected right away with just the instance name (no ~\\MSSQLSERVER).启用此功能并重新启动后,我的 SSMS 立即仅使用实例名称(没有 ~\\MSSQLSERVER)连接。

为成功连接,以下所有服务都应运行:SQL 完整测试过滤器守护程序、SQL 服务器 (SQLEXPRESS)、SQL Server 代理 (SQLEXPRESS)、SQL Server 浏览器、SQL Server 报告服务和 SQL Server VSS 编写器

什么都看不到,请写清楚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM