How to Enable Firewall Incoming Database Connections

The firewall running on the database server may block the incoming remote TCP/IP connections. For Windows servers the easiest way to enable TCP/IP for example for port 1433 is to execute this line from Command Prompt. Check first the database configured port, 1433 is the usual value for SqlServer.
netsh advfirewall firewall add rule name=SQLPort dir=in protocol=tcp action=allow localport=1433 remoteip=localsubnet profile=DOMAIN
Alternative you can use this steps:
  1. On the Windows Start search for 'Windows Firewall'.

    Setup Windows Firewall for database connectivity
  2. In the Windows Firewall with Advanced Security, in the left pane, right-click Inbound Rules, and then click New Rule in the action pane (upper right corner).

    Firewall 2
  3. In the Rule Type dialog box, select Port, and then click Next.
  4. In the Protocol and Ports dialog box, select TCP. Select Specific local ports, and then type the port number of the instance of the Database Engine, In my case we are using the default which is 1433. Click Next.
  5. In the Action dialog box, select Allow the connection, and then click Next.
  6. In the Profile dialog box, I am going to Leave Domain turned on and turn private and public off. Then click Next.
  7. In the Name dialog box, type "Allow SQL 1433 Inbound” and for a description I am putting in the same. Then click Finish.
For linux servers please look in google.