一、配置管理器内启动TCP/IP协议(端口改为1433)以及加入防火墙允许

1、允许远程连接到此服务器

2、切换服务器身份验证为(SQL Server 和 Windows 身份验证模式)

3、启用sa用户


3、SQL Server 2017 配置管理器
3.1、启用 SQL Server Browser 服务

3.2、SQL Server 网络配置
启用TCP/IP,并设置TCP端口(默认为1433,可自定义)


4、配置Windows 防火墙
运行firewall.cpl→打开防火墙→高级设置→入站规则→新建规则







二、进入本地实例
运行cmd运行以下代码
Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>sqlcmd -S .\SQLEXPRESS
1> select @@version
2> GO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64)
Aug 22 2017 17:04:49
Copyright (C) 2017 Microsoft Corporation
Express Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
(1 行受影响) //使用DAC允许远程连接
1> sp_configure 'remote admin connections',1
2> GO
配置选项 'remote admin connections' 已从 0 更改为 1。请运行 RECONFIGURE 语句进行安装。
1> RECONFIGURE
2> select @@version
3> GO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64)
Aug 22 2017 17:04:49
Copyright (C) 2017 Microsoft Corporation
Express Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
(1 行受影响)
1>
网友评论