sql server 默认实例的更改

查了很多文章,都说无法更改默认实例,只能卸载并重新安装。的确也是这样。但是有其他办法变通解决。关于具体的设置办法可以查询下面的网址

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-a-server-to-listen-on-a-specific-tcp-port?view=sql-server-2017

 

Configure a Server to Listen on a Specific TCP Port

This topic describes how to configure an instance of the SQL Server Database Engine to listen on a specific fixed port by using the SQL Server Configuration Manager. If enabled, the default instance of the SQL Server Database Engine listens on TCP port 1433. Named instances of the Database Engine and SQL Server Compact are configured for dynamic ports. This means they select an available port when the SQL Server service is started. When you are connecting to a named instance through a firewall, configure the Database Engine to listen on a specific port, so that the appropriate port can be opened in the firewall.

Because port 1433 is the known standard for SQL Server, some organizations specify that the SQL Server port number should be changed to enhance security. This might be helpful in some environments. However, the TCP/IP architecture permits a port scannerto query for open ports, so changing the port number is not considered a robust security measure.

For more information about the default Windows firewall settings, and a description of the TCP ports that affect the Database Engine, Analysis Services, Reporting Services, and Integration Services, see Configure the Windows Firewall to Allow SQL Server Access.

 Tip

When selecting a port number, consult https://www.iana.org/assignments/port-numbers for a list of port numbers that are assigned to specific applications. Select an unassigned port number. For more information, see The default dynamic port range for TCP/IP has changed in Windows Vista and in Windows Server 2008.

 Warning

The Database Engine begins listening on a new port when restarted. However the SQL Server Browser service monitors the registry and reports the new port number as soon as the configuration is changed, even though the Database Engine might not be using it. Restart the Database Engine to ensure consistency and avoid connection failures.

Using SQL Server Configuration Manager

To assign a TCP/IP port number to the SQL Server Database Engine
  1. In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for <instance name>, and then double-click TCP/IP.

     Note

    If you are having trouble opening SQL Server Configuration Manager, see SQL Server Configuration Manager.

  2. In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. (You will probably see both IP version 4 and IP version 6 addresses.) Right-click each address, and then click Properties to identify the IP address that you want to configure.

  3. If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.

    TCP_ports

  4. In the IPn Properties area box, in the TCP Port box, type the port number you want this IP address to listen on, and then click OK. Multiple ports may be specified by separating them with a comma.

     Note

    If the Listen All setting on the Protocol tab is set to "Yes", then only TCP Port and TCP Dynamic Port values under the IPAllsection will be used and individual IPn sections will be ignored in their entirety. If the Listen All setting is set to "No", then the TCP Port and TCP Dynamic Port settings under the IPAll section will be ignored and the TCP PortTCP Dynamic Port, and Enabled settings on the individual IPn sections will be used instead. Each IPn section has an Enabled setting with a default value of "No" which causes SQL Server to ignore this IP address even if it has a port defined.

  5. In the console pane, click SQL Server Services.

  6. In the details pane, right-click SQL Server (<instance name>) and then click Restart, to stop and restart SQL Server.

Connecting

After you have configured SQL Server to listen on a specific port, there are three ways to connect to a specific port with a client application:

  • Run the SQL Server Browser service on the server to connect to the Database Engine instance by name.
  • Create an alias on the client, specifying the port number.
  • Program the client to connect using a custom connection string.

 

然后就是软件的设置问题。如何设置连接参数?大概有两种方式:

1、 127.0.0.1\sqlserver2008,2008   。使用这种方式,可以指定服务器ip地址,但是后面必须带端口。

2、.\sqlserver2008 。这种方式,主要用在服务器中。无需指定端口和ip,直接默认使用1433端口,并指向本机,且兼容性好。

 

转载于:https://my.oschina.net/ethanleellj/blog/3038456

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值