I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?
6 Answers
127.0.0.1,6283
Add a comma between the ip and port
-
13I just chased my tail for an hour trying to figure out how to give the port. Nowhere on MSDN. Stack Overflow to the rescue again!– ChristoJun 28, 2011 at 12:23
-
21Shit... big fail MS... THX... and for some reason if you're tunneling: use 127.0.0.1 instead of localhost... SQL MStudio doesnt like it for some reason..– DavidApr 2, 2012 at 15:28
-
1same as you guys, but worse. I had the case some years ago. Did not remember the workaround exactly today as I needed it ... if They use a "different" syntax, why can't they at least mention it in the right places !! Jul 13, 2012 at 17:09
-
5@mark Agreed, but it should be no surprise really - this is the same company that ignored the rest of the world and decided to use backslashes in file paths. sigh– ScottJan 9, 2013 at 15:31
-
6The colon becomes less meaningful when you connect to an IPv6 address. Jul 30, 2013 at 15:51
If you're connecting to a named instance and UDP is not available when connecting to it, then you may need to specify the protocol as well.
Example: tcp:192.168.1.21\SQL2K5,1443
-
3thanks very much. this was correct. only I did only need the instance name followed by port. eg INSTANCENAME\INSTANCE,1541– mikoopNov 3, 2017 at 0:37
Another way is to setup an alias in Config Manager. Then simply type that alias name when you want to connect. This makes it much easier and is more prefereable when you have to manage several servers/instances and/or servers on multiple ports and/or multiple protocols. Give them friendly names and it becomes much easier to remember them.
-
This is a great answer, always better to have a descriptive name that an ip address, especially for new maintainers in your code– ENDEESAMay 3, 2020 at 8:36
You'll need the SQL Server Configuration Manager. Go to Sql Native Client Configuration, Select Client Protocols, Right Click on TCP/IP and set your default port there.
-
3That is good if all the databases you connect to use the same port. Not the case in all environments.– BrettskiDec 6, 2013 at 5:31
Using the client manager affects all connections or sets a client machine specific alias.
Use the comma as above: this can be used in an app.config too
It's probably needed if you have firewalls between you and the server too...
On Windows plattform with server execute command:
netstat -a -b
look for sql server
processes and find port f.e 49198
Or easier. Connect with dbvisualizer, run netstat -a -b
find dbvis.exe process and get port.