简体   繁体   English

SQL Server默认实例:如果更改主机名

[英]SQL Server Default Instance: If you change host machine's name

Say I have a Server named "MyServerABC", on which I have Sql Server 2005 installed with a Default Instance. 假设我有一台名为“ MyServerABC”的服务器,在该服务器上安装了带有默认实例的Sql Server 2005。 Thus I can always connect to my sql server just by specifying "MyServerABC". 因此,只要指定“ MyServerABC”,我就可以始终连接到我的sql服务器。

Now, I change my server's name to "MyServerDEF". 现在,我将服务器的名称更改为“ MyServerDEF”。 Will I now be able to connect to the sql server by just specifying "MyServerDEF"? 现在是否只需指定“ MyServerDEF”就可以连接到sql服务器?

Are there any holes in my thinking? 我的思维有漏洞吗? Is it really that simple, or are there additional steps involved, or potential problem areas? 真的那么简单吗,还是涉及其他步骤,还是潜在的问题领域?

Yes, that's correct from a remote connection view if you change MyServerABC to MyServerDEF in connection strings. 是的,如果将连接字符串中的MyServerABC更改为MyServerDEF,则从远程连接视图中是正确的。

There are a few more things to consider (@@SERVERNAME will not change by default for example) so have a look here: How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server 还需要考虑其他事项(例如,默认情况下,@@ SERVERNAME不会更改),因此请在此处查看: 如何:重命名承载SQL Server独立实例的计算机

Often, you'd use MyServerPermanentAlias as a network DNS entry too so the actual server name is irrelevant. 通常,您也将MyServerPermanentAlias用作网络DNS条目,因此实际的服务器名称无关紧要。

If you use the machine name to connect, you will have to change your connection strings. 如果使用计算机名称进行连接,则必须更改连接字符串。 If that's what you are looking for, then yes, it's that easy - no additional steps needed. 如果您正在寻找的是,那么就很简单-无需其他步骤。

That's why you can also use (local) or just "." 这就是为什么您还可以使用(local)或仅使用“”的原因。 as shortcuts for the local machine. 作为本地计算机的快捷方式。

Marc

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

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