[Fix] Cannot connect to Microsoft SQL Server, Error: 18456

Error Message:
Connect to Server

Cannot connect to server-name.

Additional information:

Login failed for user 'user\Administrator'. (Microsoft SQL Server, Error: 18456)

Error 18456 Screenshot:
Microsoft SQL Server Error- 18456
Product Name	SQL Server
Event ID	18456
Component	SQLEngine
Symbolic Name	LOGON_FAILED
Message Text	Login failed for user '%.*ls'.%.*ls


The 18456 error occurs when the connection request to SQL Server has been rejected due to authentication failure


Make sure to provide a valid database username and password!

Addition information will be provided with the 18456 error response that could be helpful to troubleshoot the root cause.

Msg 18456, Level 14, State 9, Server hostName, Line 1"

State	Description
1 -> Error information is not available. This state usually means you do not have permission to receive the error details. Contact your SQL Server administrator for more information.
2 -> User ID is not valid.
5 -> User ID is not valid.
6 -> An attempt was made to use a Windows login name with SQL Server Authentication.
7 -> Login is disabled, and the password is incorrect.
8 ->The password is incorrect.
9 -> Password is not valid.
11 -> Login is valid, but server access failed. One possible cause of this error is when the Windows user has access to the SQL Server as a member of the local administrator's group, but Windows is not providing administrator credentials. To connect, start the connecting program using the Run as administrator option, and then add the Windows user to SQL Server as a specific login.
12 -> Login is a valid login, but server access failed.
18 -> Password must be changed.
38, 46 -> Could not find the database requested by the user.
58 -> When SQL Server is set to use Windows Authentication only, and a client attempts to log in using SQL authentication. Another cause is when SIDs do not match.
102 - 111 -> AAD failure.
122 - 124 -> Failure due to an empty username or password.
126 -> Database requested by the user does not exist.
132 - 133 -> AAD failure.
More Details reference: link

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap