Unable to connect to the server, user xxx login failed"

Source: Internet
Author: User
Tags builtin mssqlserver
Unable to connect to the Server. The error "xxx login failed" is caused by SQL Server's "Windows only" authentication method,
Therefore, you cannot connect to the SQL Server login account (such as sa). The solution is as follows:
1. Use the enterprise manager on the Server side and select "use Windows Authentication" to connect to SQL Server
In enterprise manager
-- Right-click your server instance (the one with the green icon)
-- Edit SQL Server registration attributes
-- Select "use windows Authentication"
2. Expand "SQL Server Group", right-click the name of the SQL Server, select "properties", and then select the "security" tab.
3. Under "authentication", select "SQL Server and Windows ".
4. Restart the SQL Server service.
In the preceding solution, if "use Windows Authentication" fails to connect to SQL Server in step 1, modify the registry to solve the problem:
1. Click "Start"-"run", enter regedit, and press enter to enter the registry editor.
2. Expand the registry key in sequence and browse to the following Registry key:
[HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ MSSQLServer]
3. Find the name "LoginMode" on the right of the screen and double-click to edit the double-byte value.
4. Change the original value from 1 to 2 and click "OK"
5. Disable Registry Editor
6. Restart the SQL Server service.
In this case, you can successfully use sa to create an SQL Server registration in the enterprise manager,
However, you still cannot connect to SQL Server in Windows authentication mode.
This is because there are two default logon accounts in SQL Server:
BUILTIN \ Administrators
<Machine name> \ Administrator deleted.
To restore these two accounts, you can use the following methods:
1. Open the Enterprise Manager, expand the server group, and then expand the server
2. Expand security, right-click logon, and click New logon"
3. In the name box, enter BUILTIN \ Administrators
4. On the "server role" tab, select "System Administrators"
5. Click "OK" to exit
6. Use the same method to add <machine name> \ Administrator to log on.
Note:
The following Registry key:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ MSSQLServer \ LoginMode
The value determines the authentication mode that SQL Server will adopt.
1. Indicates that the "Windows Authentication" mode is used.
2. Indicates that the hybrid mode is used (Windows Authentication and SQL Server authentication ).

Unable to connect to the server, user xxx login failed"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.