Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't connect to localhost, but can with computer name in SQL Server 2008

Tags:

sql-server

If someone followed this post and still hasn't solved their problems (like me), here's what solved it for me:

Step 1: I went to the TCP/IP line in SQL Server Network Configuration, under Protocols for SQLEXPRESS (though you should select your active sql server) and clicked on properties:

enter image description here

Step 2: Then, I made sure that under IP Addresses, the group IP4 is Enabled = "Yes", and that the TCP Port in there is set to 1433 (the default sql server port), like here:

enter image description here

Step 3: Lastly, just as a precaution, I've changed all the other IP group ports to 1433 also, and enabled = "Yes" them from IP2 to IP5 (I saw this one at another computer). I've also changed the IPAll's (the last group) TCP Port to 1433 as well. But that's just me. I'm crazy. Go crazy. It's good for you. Last, make sure Enabled is set to Yes on the protocol tab as well.


and then - Hooray! it worked. Cheers for all the good-hearted people that take their time to solve other people's problems.


You probably need to set Sql Server to allow "remote" connections:

  1. Go to Start > All Programs > Microsoft Sql Server 2008 > Configuration Tools > Sql Server Configuration Manager
  2. When the configuration manager has loaded, expand the "SQL Server Network Configuration" node of the treeview to the left
  3. Select the Sql Server instance that you're trying to connect to in the tree
  4. All three of "Shared Memory", "Named Pipes" and "TCP/IP" should show as Enabled in the list to the right. For any that don't, double click each one in turn and change Disabled to Enabled in the window that appears.
  5. Click on "Sql Server Services" in the treeview
  6. Choose "SQL Server (InstanceName)" (where InstanceName will probably be SqlExpress or MsSqlServer), right click and choose Restart

Once the restart has completed, try connecting again - it should work now.


Use localhost\sql_server_instance_name

For example, localhost\sqlexpress

Use . instead of 127.0.0.1

.\sqlexpress


You can also try: .\sql_server_instance_name

.\SQLExpress