Below we describe how to solve these three most common connection errors.
The first error "SQL Server does not exist or access" is often the most complicated, and there are more reasons for error, and there is more ways to check. Generally speaking, there are several possibilities: 1, SQL Server name or IP address spelling is incorrect;
2, the server-side network configuration is incorrect;
3, client network configuration is incorrect.
To solve this problem, we generally follow the following steps to find out the cause of the error.
First, check the network physical connection:
PING
PING
If ping
If the Ping
1. Use Notepad to open the HOSTS file (in general in C: / WinNT / System32 / Drivers / etc).
2, add a corresponding record of the IP address and the server name, such as:
172.168.10.24 MyServer
You can also configure it in the client network utility of SQL Server, which will be described in detail later.
Second, check the SQL Server server working status using the Telnet command:
Telnet
If the command is executed successfully, you can see the screen after flashing, the cursor does not flash in the upper left corner, which means that the SQL Server server is working properly and is listening to the TCP / IP connection of the 1433 port; if the command returns "Unable to open the connection" error Information, the server side does not start the SQL Server service, or the server-side does not enable the TCP / IP protocol, or the server side does not listen on the default port 1433 of SQL Server.
Next, we have to check the server-side network configuration on the server, check whether named pipes are enabled, and the TCP / IP protocol is enabled. We can use the Server network using the SQL Server to check.
Click: Program -> Microsoft SQL Server -> Server Network Using Tools, the screen you see after opening the tool is shown below:
From here we can see which protocols have been enabled. In general, we enable naming pipes and TCP / IP protocols.
TCP / IP protocol, select "Properties", we can check the settings of the SQK Server service default port, as shown below:
In general, we use SQL Server default 1433 ports. If the Hidden Server is selected, it means that the client cannot see this server by enumerating the server, but does not affect the connection. Check the server-side network configuration, then we want to check the client's network configuration. We can also use the client network used by SQL Server to check, the difference is that this time is the client running this tool.
Click: Program -> Microsoft SQL Server -> Client Network Using Tools, the screen you see after opening the tool is shown below:
From here we can see which protocols have been enabled. In general, we also need to enable naming pipes and TCP / IP protocols.
Click the TCP / IP protocol, select Properties, you can check the settings of the client default connection port, as shown below.
This port must be consistent with the server.
Click the Alias tab, you can also configure alias for the server. The alias of the server is the name used to connect, and the server in the connection parameter is a real server name, both of which may be the same or different. As shown in the figure, we can use MyServer instead of the true server name SQL2KCN-02, and use the network library Named Pipes. The settings of the alias are similar to using the HOSTS file.
Through the above aspects, the cause of error 1 can be substantially excluded. Below we will describe how to solve the error 2 in detail.
When the user is trying to connect SQL Server using SA in the query analyzer, or when using SA to create a SQL Server registration, the error message shown in FIG. 2 is often encountered. The reason for this error is because SQL Server uses "Windows" authentication mode, so users cannot connect to SQL Server login accounts (such as SA). The solution is as follows:
1. Use the Enterprise Manager on the server side and select "Use Windows Authentication" to connect SQL Server;
2. Expand "SQL Server Group", right-click the name of the SQL Server server, select "Properties", and select the Security tab;
3. Under "Authentication", select "SQL Server and Windows".
4. Restart SQL Server service.
In the above solution, if you use "using Windows Authentication" to connect SQL Server in step 1, we will encounter a two difficult situation: First, the server only allows Windows authentication; second, even if it is used Windows Authentication still cannot connect to the server. This situation is called "lock yourself outside the door", because the user does not use it in any way. In fact, we can change the authentication method to SQL Server and Windows hybrid verification by modifying a registry key value, steps below:
1. Click "Start" - "Run", enter regedit, enter the registry editor to enter the registry;
2. Expand the registry key in turn, browse to the following registry key:
[HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / MSSQLServer / MSSQLServer]
3, find the name "loginmode" on the right side, double-click the edit two-by-quarter value; 4, change the original value from 1 to 2, click "OK";
5, turn off the registry editor;
6, restart SQL Server service.
At this point, the user can successfully use SA to create new SQL Server registration in the Enterprise Manager, but still unable to connect SQL Server using Windows authentication mode. This is because there are two default login accounts in SQL Server: Builtin / Administrators, and
1. Open Enterprise Manager, expand the server group, and then expand the server;
2, expand "Security", right-click "Login", and then click New Login ";
3. In the Name box, enter Builtin / Administrators;
4. In the Server Role tab, select "System Administrators";
5. Click "OK" to exit;
6. Use the same method to add
The following registration key
HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / MSSQLServer / MSSQLServer / Loginmode
The value determines what authentication mode will be taken by SQL Server. This value is 1, indicating using a Windows authentication mode; this value is 2, indicating using a mixed mode (Windows Authentication and SQL Server Authentication).
After reading how to solve the first two wrong methods, let's take a look at the third error as shown in Figure 3.
If you encounter a third error, in general, the client has already found this server and can be connected, but the time is greater than the time allowed to cause an error. This generally occurs when the user runs the Enterprise Manager on the Internet, which may cause the above timeout error when it is slowly connected to the Internet. In some cases, due to the network problems of the LAN, such errors can also be caused.
To solve such an error, you can modify the client's connection timeout setting. By default, the timeout setting for another SQL Server through the Enterprise Manager is 4 seconds, and the query analyzer is 15 seconds (this is why the possibility of errors in the Enterprise Manager is relatively large). The specific steps are:
1. In the Enterprise Manager, select "Tools" on the menu and select Options.
2. In the Snql Server Enterprise Manager Properties window that pops up, click the Advanced tab;
3. Enter a relatively large number in the "Login Timeout (Second)" right side of "Connection Settings", such as 20.
The query analyzer can also be set in the same position.
In Windows Control Book -> Management Tools -> Services -> MSSQLServer -> Properties -> Change to your new operating system password! Or in the Windows Control Book -> Management Tools -> Services -> MSSQLSERVER -> Properties -> to log in to local!