Failed to connect to SQL SERVER by using IP address or configuring as connection string
Scenario 1: WhenWebconfigFile
<Add key = "ConnectionString" value = "server = 127.0.0.1; database = database name; uid = sa; pwd = 1"/> to connect to the database, I found that I could not log on normally during login and encountered a lot of errors;
Scenario 2:
Alternatively, when you connect to SQL SERVER, enter the following IP Address:
The system prompts that a connection fails or a connection error occurs.
Solution:
Step 1: Check TCP/IPWhether the protocol has been started:
In the "Start" menu, find "Configuration tools" in microsoft SQL server 2005, open SQL SERVER Configuration Manager, and click in. Select the SQLEXPRESS protocol, in "TCP/IP" on the right, double-click it and enable it if "disabled" is displayed:
Step 2: Select "MSSQLSERVER protocol" and enable "TCP/IP"
Step 3: select the subnode "Client protocol" in "SQL Native Client configuration" and check whether the "TCP/IP" Protocol on the right is enabled. If not, enable it:
Step 4: Double-click "TCP/IP protocol" to view the properties panel and check whether the listening port is port 1433.
Step 5: restart the computer ~~ Test logon ~~ Succeeded ~~~
Additional:
If "local" or "localhost" cannot be used
Solution:
Open the C: \ Windows \ System32 \ drivers \ etc path and find
Hosts file;
Open it in notepad to see if there are any examples:
Copy codeThe Code is as follows:
# Localhost name resolution is handled within DNS itself.
#127.0.0.1 localhost
If not, add them below;
Then restart the computer ~~ OK ~~