How to enable remote connections to SQL Server

Problem in hand
So you have a VM or a remote server, that you have installed SQL Server, but you also want to connect to SQL Server using SQL Server Management Studio on your local system, but gives you this error.
This is because you haven’t configured it to allows inbound connections from firewall or from SQL Server itself, could be both.
Prerequisites
- Remote server/VM must have SQL Server Management Studio and SQL Server Configuration Manager Installed.
- Remote SQL Server must have a user that have read and write privileges (Here I’m using sa user)
All set, let’s start
Connect to the server/VM using Remote Desktop Connection and open up SQL Server Management Stdio on remote server, then connect to the SQL Server instance.

Connect to SQL Server instance from remote server.

Go to server properties.
Now right click on the server and go to Properties.

On the Connections page under Remote server connections, make sure that the Allow remote connections to this server is checked.

Now open SQL Server Configuration Manager.

Visit Protocols for <instance name>, in my case Protocols for MSSQLSERVER under SQL Server Network Configuration node, go to TCP/IP and make sure the ‘Status’ is set to Enabled. If not, right click and select Enable.

<img src="https://miro.medium.com/max/1174/1*e4MOVOGwNWMMp6I8dqAlCA.jpeg" class="ge n o gd ab" width="587" height="362"/>
After that, again right click and select Properties of TCP/IP protocol.

Goto IP Addresses tab and go down until you see IPALL section. Make sure the TCP Port is set to 1433. If not set it to 1433.

This warning will appear, so we need to restart the server. we can do it by using SQL Server Configuration manager.

Locate SQL Server under SQL Server Services, right click and select Restart.
Now lets configure the firewall.
<img src="https://miro.medium.com/max/786/1*Eu26_9BcTkA851nvnT1ULw.jpeg" class="ge n o gd ab" width="393" height="640"/>
Open up Windows Firewall.

Go to Inbound Rules and select New Rule.
Add the following rule. Follow images if unclear.
Rule Type: Port
Protocol and Ports: TCP, 1433
Action: Allow the connection
Profile: Domain, Private, Public
Name: SQLTCP1433





Click finish. We need to add another rule for UDP connections as well.
Rule Type: Port
Protocol and Ports: UDP, 1434
Action: Allow the connection
Profile: Domain, Private, Public
Name: SQLUDP1434

Let’ make SQL Server and SQL Server Browser accessible through firewall.
Rule Type: Program
Program: C:\Program Files\Microsoft SQL Server\<Server version>.<Instance name>\MSSQL\Binn\sqlservr.exe
e.g. C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Binn
Action: Allow the connection
Profile: Domain, Private, Public
Name: SQLSERVER




One more rule for the SQL Server Browser.
Rule Type: Program
Program: C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe
Action: Allow the connection
Profile: Domain, Private, Public
Name: SQLBROWSER


Now all four rules are setup.

Make sure the SQL Server Browser and SQL Server is set to start automatically. Go back to SQL Server Configuration Manager and right click on SQL Server Browser under SQL Server Services, click Properties.

Under Service tab, select Automatic for Start mode.

Click Apply. Now let’s make sure that we keep the service failures to minimum.
- Click the Windows key + R to open the Run window.
- Type services.msc in the Open: box.
- Click OK.

Find the SQL Server service, right click and select Properties.

On the Recovery tab select Restart the Service for First failure, Second failure, Subsequent failures.
…and Done!.
Try again to connect.


Awesome! You did it. :)
How to enable remote connections to SQL Server的更多相关文章
- SQL: enable sa Account in SQL Server
Link: http://sudeeptaganguly.wordpress.com/2010/04/20/how-to-enable-sa-account-in-sql-server/ 引用: Wh ...
- Enable a SQL Server Trace Flag Globally on Linux
https://www.mssqltips.com/sql-server-tip-category/226/sql-server-on-linux// Microsoft has recently r ...
- System.Data.SqlClient.SqlException: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - 定位指定的服务器/实例时出错)
A network-related or instance-specific error occurred while establishing a connection to SQL Server. ...
- 【SQL Server 问题记录】A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.
本文涉及的相关问题,如果你的问题或需求有与下面所述相似之处,请阅读本文 A network-related or instance-specific error occurred while esta ...
- Microsoft SQL Server Trace Flags
Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...
- Microsoft SQL Server Version List [sqlserver 7.0-------sql server 2016]
http://sqlserverbuilds.blogspot.jp/ What version of SQL Server do I have? This unofficial build ch ...
- Microsoft SQL Server Version List(SQL Server 版本)
原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Servic ...
- [MS SQL Server]SQL Server如何开启远程访问
在日常工作中,经常需要连接到远程的MS SQL Server数据库中.当然也经常会出现下面的连接错误. 解决方法: 1. 设置数据库允许远程连接,数据库实例名-->右键--->属性---C ...
- 解决SQL Server管理器无法连接远程数据库Error: 1326错误
解决SQL Server管理器无法连接远程数据库Error: 1326错误 我们在在使用SQL Server时都会遇到使用SQL Server Management Studio无法连接远程数据库实例 ...
随机推荐
- MySQL优化相关参数--先做个记录,以后可能用得到
innodb_io_capacity:可设置的磁盘IO性能参数,越高代表当前mysql的IO性能更好,可用做决策刷脏页速度的参数: innodb_flush_neighbors:刷脏页是否开启连坐机制 ...
- postgresql获取表最后更新时间(通过触发器将时间写入另外一张表)
通过触发器方式获取表最后更新时间,并将时间信息写入到另外一张表 一.创建测试表和表记录更新时间表 CREATE TABLE weather( city varchar(80), temp_lo int ...
- No hash for parcel CDH-XXX.parcel.torrent
在安装 CDH 时,到 Install Parcels 这一步,分发 Parcels 一直过不去,界面一直报 Failure due to stall on seeded torrent,查看日志一直 ...
- 性能监控系统 | 从0到1 搭建Web性能监控系统
工具介绍 1. Statsd 是一个使用Node开发网络守护进程,它的特点是通过UDP(性能好,及时挂了也不影响主服务)或者TCP来监听各种数据信息,然后发送聚合数据到后端服务进行处理.常见支持的「G ...
- git send-email时报错:Client host rejected: cannot find your hostname 如何处理?
1. 先找出ip对应的域名 dig +short -x <your ip> 2. 如果第1步没有输出,那么需要将hostname与ip绑定,如:hostname为jello,那么是往/et ...
- 图解Python 【第二篇】:Python基础2
本节内容一览图 一.数据类型 1.数字 2 是一个整数的例子.长整数 不过是大一些的整数.3.23和52.3E-4是浮点数的例子.E标记表示10的幂.在这里,52.3E-4表示52.3 * 10-4. ...
- openstack核心组件--neutron网络服务2(4)
一.虚拟机获取 ip: 用 namspace 隔离 DHCP 服务 Neutron 通过 dnsmasq 提供 DHCP 服务,而 dnsmasq 通过 Linux Network Names ...
- 三分钟读懂TT猫分布式、微服务和集群之路 (转)
http://www.cnblogs.com/smallSevens/p/7501932.html 针对新手入门的普及,有过大型网站技术架构牛人路过,别耽误浪费了时间,阅读之前,请确保有一定的网络基础 ...
- Qt 字符映射表 显示图标
一.利用字符映射表segmdl2.ttf,窗体显示字符图片. 在win10里面搜“字符映射表”,选择字体segmdl2.ttf,查看图标对应得16进制值.把此字体拷贝到程序的目录下. 二.使用 #if ...
- android#使用Intent传递对象
参考自<第一行代码>——郭霖 Intent的用法相信你已经比较熟悉了,我们可以借助它来启动活动.发送广播.启动服务等.在进行上述操作的时候,我们还可以在Intent中添加一些附加数据,以达 ...