Site icon GetCodify

How to configure SQL server to access it remotely

MS SQL Server

How to configure SQL server to access it remotely?, Actually this is not a big issue there are some straightforward steps to configure, but there might be a possibility of giving problem after configure using the same steps also. So go through the below steps carefully.

To establish a successful remote connection is to set up ports through the Window Firewall. In SQL Server there are two types of instances. First is a default instance and the second is a named instance. To connect to the default instance of Database Engine, or named instance that is the only instance installed on the machine, the TCP port 1433 is the only port that you need to specify.

But if you have multiple named instances installed on your machine, to connect with one of them, we must provide a port number which corresponding to appropriate instance name. By default named instance used a dynamic port, which means that every time when the Database Engine starts new port number is assigned. Because of that, it is difficult to configure Windows Firewall to enable access.

In order to resolve this problem, there is a SQL Browser service, which provides the TCP port number that corresponds to the named instances. The SQL Browser services use UDP port 1434. Now we met with the basic matters relating to the remote connection, let’s continue with the setup procedure.

Enabling TCP/IP protocol

The first step is to enable TCP/IP protocol on the SQL Server service. Open the SQL Server Configuration Manager in the Configuration Tools folder under the Microsoft SQL Server folder:

From the SQL Server Network Configuration node, select the Protocols item for the appropriate SQL Server. In the details pane, right-click the TCP/IP item and select the Enable option:

Note: After this please check whether the TCP/IP Ports are configured properly or not, for that before configuring inbound rules below check this step. In some SQL installation by default takes 1433 as TCP port if not change all to IP TCP Port Rules to 1433 as shown below:

Right click on “TCP/IP”  and select properties:

In Properties put 1433 as TCP port and make dynamic port as blank to all IP properties from IP1 to IPAll as Shown Below:

After this step, the Warning box pop up in which informs us that changes that are made won’t take effect until the next time service is started.

For the changes to take effect, from console pane, select the SQL Server Services and from the details panel right-click the SQL Server (SQLEXPRESS) database engine instance and click the Restart option:

Now the service started with TCP/IP enabled, but still can’t connect remotely until we configure the Windows Firewall.

Click on Page 2 to continue

Configuring Windows Firewall

From the Control Panel choose Windows Firewall and click the Advanced settings or just type wf.msc in Search program and files from the Start menu:

In the Windows Firewall with Advanced Security, click the Inbound Rules from the left pane, right-click Inbound Rules and select the New Rule or from the Actions pane click the New Rule:

On which you will click, it’s up to you. In both cases, the New Inbound Rule Wizard will appear. Under the Rule Type chooses Port and click the Next button:

In the Protocols and Ports, there are several options that you can choose, depending on which type of protocols you select.

As we mentioned at the beginning of the article TCP is used for the default instance and named instance if is the only instance installed on the machine and default port is 1433.

For this example, select the UDP protocol and in the Specific local ports enter port number 1434. To proceed with the settings SQL Browser services, click the Next button:

In the Action dialog choose Allow the connection and click the Next button:

In the Profile, dialog chooses all three profiles and click the Next:

On this step give the rule a name and click the Finish.

Note: When we give the name of the rule, please write some descriptive name that you can understand later when you need to find them or edit in the Inbound Rules list.

Click on Page 3 to continue

Now create an allow rule for the database engine instance.

Go to the New Rule and from the Rule Type select the Custom rule:

In the Program under the Services click the Customize button:

From the Customize Service Settings under Apply to this service select database engine instance service and click the OK button:

Then click the Next all the way to the Name dialog, give rule a name and click the Finish:

Now when all rules are set up, you are ready to connect to remote SQL Server.

Start the SQL Server, in the dialog window for the Server name enters the name of the instance that you want to connect with. From the Authentication drop-down box, select the SQL Server Authentication and for the field Login and the Password enter your credentials then click the Connect button.

 

Exit mobile version