Unable to login to SQL Server + SQL Server Authentication + Error: 18456

Sql ServerSql Server-2008

Sql Server Problem Overview


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.

Sql Server Solutions


Solution 1 - 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.

Solution 2 - Sql Server

By default login failed error message is nothing but a client user connection has been refused by the server due to mismatch of login credentials. First task you might check is to see whether that user has relevant privileges on that SQL Server instance and relevant database too, thats good. Obviously if the necessary prvileges are not been set then you need to fix that issue by granting relevant privileges for that user login.

Althought if that user has relevant grants on database & server if the Server encounters any credential issues for that login then it will prevent in granting the authentication back to SQL Server, the client will get the following error message:

Msg 18456, Level 14, State 1, Server <ServerName>, Line 1
Login failed for user '<Name>'

Ok now what, by looking at the error message you feel like this is non-descriptive to understand the Level & state. By default the Operating System error will show 'State' as 1 regardless of nature of the issues in authenticating the login. So to investigate further you need to look at relevant SQL Server instance error log too for more information on Severity & state of this error. You might look into a corresponding entry in log as:

2007-05-17 00:12:00.34 Logon     Error: 18456, Severity: 14, State: 8.
or

2007-05-17 00:12:00.34 Logon     Login failed for user '<user name>'.

As defined above the Severity & State columns on the error are key to find the accurate reflection for the source of the problem. On the above error number 8 for state indicates authentication failure due to password mismatch. Books online refers: By default, user-defined messages of severity lower than 19 are not sent to the Microsoft Windows application log when they occur. User-defined messages of severity lower than 19 therefore do not trigger SQL Server Agent alerts.

Sung Lee, Program Manager in SQL Server Protocols (Dev.team) has outlined further information on Error state description:The common error states and their descriptions are provided in the following table:

ERROR STATE       ERROR DESCRIPTION
------------------------------------------------------------------------------
2 and 5           Invalid userid
6                 Attempt to use a Windows login name with SQL Authentication
7                 Login disabled and password mismatch
8                 Password mismatch
9                 Invalid password
11 and 12         Valid login but server access failure
13                SQL Server service paused
18                Change password required


Well I'm not finished yet, what would you do in case of error:

2007-05-17 00:12:00.34 Logon     Login failed for user '<user name>'.

You can see there is no severity or state level defined from that SQL Server instance's error log. So the next troubleshooting option is to look at the Event Viewer's security log [edit because screen shot is missing but you get the

idea, look in the event log for interesting events].

Solution 3 - Sql Server

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"

Solution 4 - Sql Server

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

Solution 5 - 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.

Solution 6 - Sql Server

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

Solution 7 - Sql Server

None of the solutions will work for you if you do not restart the SQL Server.

Find the SQLServerManager13.msc

Then in SQL Server Services section select SQL Server and restart it.

Or

Select you server in the Object Explorer menu in MS SQL Server Management Studio.

Right click on it and restart

Solution 8 - Sql Server

After spending a long time and trying every suggestion on every page, this solved my problem:

> [server name] > Security > Logins > > [Login Name] > > Right Click > > Properties > > Status > > SQL Server authentication

There is a checkbox Login is locked out. It was checked and preventing me from login. I unchecked the checkbox and my problem was solved.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSreedharView Question on Stackoverflow
Solution 1 - Sql ServerPrateekSalujaView Answer on Stackoverflow
Solution 2 - Sql ServerJoe PitzView Answer on Stackoverflow
Solution 3 - Sql ServerNathan KoopView Answer on Stackoverflow
Solution 4 - Sql ServerBarryView Answer on Stackoverflow
Solution 5 - Sql ServerVasudevView Answer on Stackoverflow
Solution 6 - Sql ServerDeepesh BajracharyaView Answer on Stackoverflow
Solution 7 - Sql ServerDipanshu ChaubeyView Answer on Stackoverflow
Solution 8 - Sql ServerBehnamView Answer on Stackoverflow