Why SQL Server port number is not default 1433?

611    Asked by BenjaminMoore in SQL Server , Asked on Apr 24, 2021

Installed latest SQL Server. It is listening on port number 62628 according to server log. Why is the port number is not the default of 1433? How to change the port number back to the default 1433?

It was installed on Windows 10. The server name is MachineNameSQLEXPRESS. I did not give a name. What is  default sql server port?


Answered by Ben PHILLIPS

By default sql server port, associated database engine services are TCP 1433, 4022, 135, 1434, UDP 1434.


  The default port of SQL server is 1433, used when there is only one SQL Server named instance running on the computer. When multiple SQL Server named instances are running, they run by default under a dynamic port (49152–65535).. For a named instance ( like your express), the db engine asks Windows for an available port number (there's a range for these purposes). This port number is stored in the registry and used for subsequent starts of the engine. Unless the port is unavailable, then Windows is asked for a different port (or, if "static" port is chosen, the engine refuses to start).

Note that the documentation referred to in the other answer is incorrect. It suggests that a different number is chosen at every startup. That isn't correct. Imagine the amount of work the "firewall-people" would have!  For instance, here's the registry path for an instance on my machine, named "A": ComputerHKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL ServerAMSSQLServerSuperSocketNetLibTcp In here, there's an entry named "TcpPort" with the value of the port number that this instance is using. This is why I see the same port number even after re-starting my instance.



Your Answer

Interviews

Parent Categories