如何解决sql server2005的“不允许远程连接”错误.(how to resolve the error: "SQL Server does not allow remote connections" for SQL Server2005)

本文介绍了如何解决SQL Server远程连接的问题,主要包括三个步骤:启用远程连接、启用SQL Server浏览器服务及设置SQL Server属性。通过这些步骤确保从远程计算机可以成功连接到SQL Server。

There are several reasons for this error. (the step 1 and 2 come from other's article.)

mostly, only it will be ok after step 1 and 3 done.

1. Enable Remote Connection

If you are using SQL Server 2005 Express or SQL Server Developer editions, you have to enable Remote connection on. By default, SQL Server 2005 express, developer and evaluation editions allow local client connections only.

            You must enable remote connections for each instance of SQL Server 2005 that you want to connect to from a remote computer. To do this, follow these steps:

         i. Click Start->Programs->Microsoft SQL Server 2005->Configuration Tools->SQL Server Surface Area Configuration.


        ii. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.


       iii. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.

      iv. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Service, click Stop, wait until the MSSQLSERVER service stops, and then click Start to restart the MSSQLSERVER service to effect the above change.

2. Enable SQL Server Browser Service

If you are running SQL Server 2005 by using an instance name and you are not using a specific TCP/IP port number in your connection string, you must enable the SQL Server Browser service to allow for remote connections. For example, SQL Server 2005 Express is installed with a default instance name of Computer Name/SQLEXPRESS. You are only required to enable the SQL Server Browser service one time, regardless of how many instances of SQL Server 2005 you are running. To enable the SQL Server Browser service, follow these steps.

        i.  Click Start->Programs->Microsoft SQL Server 2005->Configuration Tools->SQL Server Surface Area Configuration.


      ii. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.


     iii. On the Surface Area Configuration for Services and Connections page, click SQL Server Browser, click Automatic for Startup type, and then click Apply.

    iv. Click Start, and then click OK.

 

    all these please refer to the picture: https://p-blog.youkuaiyun.com/images/p_blog_youkuaiyun.com/footpath/EntryImages/20081218/1.GIF

 

3. Set the sql server properties.

    i.  Click Start->Programs->Microsoft SQL Server 2005->SQL Server Management Studio

    ii. Connect to the server.

    iii. Right click the connection, selecct "Properties".

    iv. Select "connections" in the "select a page" panel.

    v.  Check the CheckBox "All remote connections to this server".

    vi. Click OK.

please refer to the picure: https://p-blog.youkuaiyun.com/images/p_blog_youkuaiyun.com/footpath/EntryImages/20081218/2.GIF

 

 

After every step is done, please restart the sql server service.

 

当在Visual Studio Code中遇到无法连接远程扩展主机服务器,报错 “Failed to resolve remote authority: SSH server closed unexpectedly. Error code: 255” 时,可以尝试以下解决办法: ### 检查网络连接 网络问题可能导致SSH连接中断。要确保本地设备和远程服务器都能正常访问网络,并且网络连接稳定。可以通过 `ping` 命令测试与远程服务器的连通性,示例命令如下: ```bash ping <远程服务器IP地址> ``` ### 检查SSH服务状态 要保证远程服务器上的SSH服务正在运行,并且监听的端口是正确的。可以在远程服务器上使用以下命令检查SSH服务状态: ```bash systemctl status sshd # 对于基于Systemd的系统 service ssh status # 对于一些旧的系统 ``` 如果SSH服务未运行,可以使用以下命令启动它: ```bash systemctl start sshd # 对于基于Systemd的系统 service ssh start # 对于一些旧的系统 ``` ### 检查SSH配置 确认本地的SSH配置文件(通常是 `~/.ssh/config`)中关于远程服务器的配置信息是否正确,包括主机名、IP地址、端口号、用户名等。示例配置如下: ```plaintext Host <自定义主机名> HostName <远程服务器IP地址> User <用户名> Port <SSH端口号> ``` ### 检查防火墙设置 防火墙可能会阻止SSH连接。要确保本地和远程服务器的防火墙允许SSH流量通过。对于基于 `iptables` 的防火墙,可以使用以下命令开放SSH端口(通常是22): ```bash iptables -A INPUT -p tcp --dport 22 -j ACCEPT ``` 对于基于 `firewalld` 的防火墙,可以使用以下命令开放SSH端口: ```bash firewall-cmd --permanent --add-service=ssh firewall-cmd --reload ``` ### 检查SSH密钥 如果使用SSH密钥进行身份验证,要确保密钥文件的权限设置正确,并且公钥已经添加到远程服务器的 `~/.ssh/authorized_keys` 文件中。可以使用以下命令设置密钥文件权限: ```bash chmod 600 ~/.ssh/id_rsa chmod 644 ~/.ssh/id_rsa.pub ``` ### 更新Visual Studio Code和远程扩展 确保使用的是最新版本的Visual Studio Code和远程开发扩展。可以在Visual Studio Code的扩展市场中检查并更新相关扩展。 ### 尝试手动SSH连接 在终端中尝试手动使用SSH连接远程服务器,命令如下: ```bash ssh <用户名>@<远程服务器IP地址> -p <SSH端口号> ``` 如果手动连接也失败,说明问题可能出在SSH配置或服务器端;如果手动连接成功,而在Visual Studio Code中连接失败,则可能是Visual Studio Code的配置问题。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值