[sql-server] Unable to login to SQL Server + SQL Server Authentication + Error: 18456

I have created login account on my localhost\sql2008 Server (Eg. User123)

Mapped to Database (default)

Authentication Mode on SQL Server is set to both (Windows and SQL)

But login to SQL Server fails with following message (for User123)

Note: Have checked multiple time that UserName / Password are typed in correctly

Error Details:

Login failed for user 'User123' (Net.SqlClient Data Provider)

Server Name : localhost\sql2008 Error Number: 18456 Severity : 14 State : 1 Line Number : 65536

any help on this please.

This question is related to sql-server sql-server-2008

The answer is


The correct solution to the problem is to make sure SQL server authentication is turned on for your SQL Server.


After enabling "SQL Server and Windows Authentication mode"(check above answers on how to), navigate to the following.

  1. Computer Mangement(in Start Menu)
  2. Services And Applications
  3. SQL Server Configuration Manager
  4. SQL Server Network Configuration
  5. Protocols for MSSQLSERVER
  6. Right click on TCP/IP and Enable it.

Finally restart the SQL Server.


You need to enable SQL Server Authentication:

  1. In the Object Explorer, right click on the server and click on "Properties"

DBMS Properties dialog

  1. In the "Server Properties" window click on "Security" in the list of pages on the left. Under "Server Authentication" choose the "SQL Server and Windows Authentication mode" radio option.

SQL Server Authentication dialog

  1. Restart the SQLEXPRESS service.

You can access this by

Right click on instance (IE SQLServer2008)
Select "Properties"
Select "Security" option
Change "Server authentication" to "SQL Server and Windows Authentication mode"
Restart the SQLServer service
    Right click on instance
    Click "Restart"

Just for anyone else reading this: This worked for me on 2012 SQL Server too. Thanks


I had this same problem, however mine was because I hadn't set the Server authentication to "SQL Server and Windows Authentication mode" (which you had) I just wanted to mention it here in case someone missed it in your question.

You can access this by

  • Right click on instance (IE SQLServer2008)
  • Select "Properties"
  • Select "Security" option
  • Change "Server authentication" to "SQL Server and Windows Authentication mode"
  • Restart the SQLServer service
    • Right click on instance
    • Click "Restart"