In the Windows Start Menu, search for “SQLServerManager14.msc” (this is the SQL Server Configuration Manager for SQL Server 2017).
Inside the tree “SQL Server Configuration Manager (Local)”, select “SQL Server Network Configuration”, then select “Protocols for MSSQLSERVER” (note: instead of MSSQLSERVER, you might see a different name depending on the name used when installing SQL Server)
Ensure that “TCP/IP” and “Named Pipes” are “Enabled” (if they are not, then right-hand click and select “Enable”)
Right-hand click on “TCP/IP”, select “Properties”, then go to the “IP Addresses” tab, scroll to the bottom to see “IPAll” and check that “TCP Port” is 1433 (this is the standard port, but if it’s another port, then take note of the port since this is relevant for connnection strings)
After you’ve saved all these changes, you can exit SQL Server Configuration Manager (restarting SQL Server will be done below, via SQL Server Management Studio).
SQL Server Management Studio
Run “SQL Server Management Studio 17” from the Windows Start Menu.
Connect to the server (localhost).
Right-hand click on the server, and click on “Properties”.
Click on the “Security” tab and for “Server authentication”, ensure that “SQL Server and Windows Authentication mode” is selected.
Click on the “Connections” tab and ensure that “Allow remote connections to this server” is selected.
Go to “Security” folder, then “Logins” folder and ensure that “sa” is enabled (if not, enable it).
Right-hand click on “sa” and select “Properties”, on the “General” tab you can set the Password if you have forgotten it. Alternatively, you can exit the properties and create another user if not using sa (which is what’s recommended for production for security reasons to create an application-specific user and assign permissions for the database). This is important for the connection string. Exit these properties.
Right-hand click on the server and click on “Restart”. This will apply any changes which were done in “SQL Server Configuration Manager” and “SQL Server Management Studio” in the steps above.
Run “Windows Defender Firewall with Advanced Security” from the Windows Start Menu.
Click on “Inbound Rules” > “New Rule”.
Select type “Port”, and click on Next.
Select “TCP and for “Specific local ports” write 1433 (or if you had another port above, then write that port), then “Next”.
Select “Allow the connection”, then “Next” and “Next”.
In the “Name” textbox, you can write something descriptive like: SQL Server Port (1433)
Type in the command: ipcofig
See the Ethernet Adapter IPv4 Address. (This is relevant for the SQL Connection string)
The result from “IP Config” (e.g. 192.168.56.1) will be used as the Host for the connection string.
The port that was set in “SQL Server Configuration Manager” (generally 1433) will be used as the Port for the connection string.
The username and password (e.g. for sa user or another specially created user) will be used as credentials for the connection string.