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无法连接远程数据库实例 ...
随机推荐
- 【零基础】为什么Facebook发币就不一样
参考: https://baijiahao.baidu.com/s?id=1637182596912694597&wfr=spider&for=pc https://blog.csdn ...
- PHP 二维数组去重方法
php二维数组的去重策略,如果需要根据某字段去重(其他字段可能不一致),那么需要使用循环策略,如果去重的都是相同的(字段,值),那么可以用序列化方式. $allComments = array_map ...
- ELMO及前期工作 and Transformer及相关论文
论文1 https://arxiv.org/pdf/1705.00108.pdf Semi-supervised sequence tagging with bidirectional languag ...
- 【MyBatis】【SQL】删除最快纪录诞生,从一千万条记录中删除八百万条仅用2分6秒
在 https://www.cnblogs.com/xiandedanteng/p/11669629.html 里我做个一个循环按时间查ID并删除之的程序,运行时间是4分7秒. 但是这个程序走了很多次 ...
- [MySql]MySql中外键设置 以及Java/MyBatis程序对存在外键关联无法删除的规避
在MySql设定两张表,其中product表的主键设定成orderTb表的外键,具体如下: 产品表: create table product(id INT(11) PRIMARY KEY,name ...
- 异步发送表单数据到JavaBean,并响应JSON文本返回
1) 提交表单后,将JavaBean信息以JSON文本形式返回到浏览器 <form> 编号:<input type="text" name="id&q ...
- easyUI之Tree(树)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...
- 发送Http请求调用webService
如果调用WebService的不是在.NET中,无法直接添加web引用,那怎么调用webservice. 有两种方式 第一种方式:GET方式 string strUrl = "http:// ...
- Swagger介绍及使用
相信无论是前端还是后端开发,都或多或少地被接口文档折磨过.前端经常抱怨后端给的接口文档与实际情况不一致.后端又觉得编写及维护接口文档会耗费不少精力,经常来不及更新.其实无论是前端调用后端,还是后端调用 ...
- Linux vi/vim命令
转自:http://www.runoob.com/linux/linux-vim.html Linux vi/vim 所有的 Unix Like 系统都会内建 vi 文书编辑器,其他的文书编辑器则不一 ...