Sql-server – Can’t connect to remote mssql server

databasephp5sql serverssmswindows-server-2008

I'm trying to connect to my remote mssql server for my GunZ private server, but for some reason i get the following error


Cannot connect to 94.xx.xx.xx.


ADDITIONAL INFORMATION:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 – An existing connection was forcibly closed by the remote host.) (Microsoft SQL Server, Error: 10054)

I pinged the port using an online port checker it said the port was open.
The Service is running
The firewall is disabled(since the system is on a virtual machine)
and tcp/ip has been enabled in the configuration manager
allow remote connections is enabled
Listen all is enabled

Best Answer

As the error message tells you, the problem is not the firewall or the remote connections, but the login process.

Since you're connecting from PHP, try password authentication instead of Windows Authentication (note that by default, password authentication is disabled for Microsoft SQL Server). PHP with Windows Authentication may be a pain, at least it was a few years ago when I tried to make it work, wasted a few days and never achieved to make it work.

If you're already using password authentication, check that it is enabled in Microsoft SQL Server itself.

If this doesn't help:

  • Check the Microsoft SQL Server logs. Sometimes, they contain interesting stuff when the authentication is not working for an obscure reason.

  • Some advise to check whether Shared Memory, Named Pipes and TCP/IP are all enabled, so check this one too (in SQL Server Configuration Manager).

  • Make sure to read the article by Pinal Dave.