Login failed for user ‘[username]‘ in SQL Server 2005

I’ve had some problems connecting to a new database on SQL Server 2005.

The error message was:
Msg 18456, Level 14, State 1, Server [server name], Line 1
Login failed for user ‘[user name]‘

Because there could be a whole lot of reasons why the logon attempt failed and because the State code returned to the clients is always 1, this is not a very helpfull error message.
To determine the true reason of the failure you have to find the corresponding entry in the server’s error log.
An example of an entry is:

2006-02-27 00:02:00.34 Logon     Error: 18456, Severity: 14, State: 18.

2006-02-27 00:02:00.34 Logon     Login failed for user ‘[user name]‘. [CLIENT: [ip address]]

 

 

n
The key to the message is the ‘State’ which the server will accurately set to reflect the source of the problem.  This is a list of the most common states:

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

If the state code is not in this list, maybe this forum can help you: MSDN Forum: SQL Server Security


Share
Oct 20th, 2006 | Posted in SQL Server
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>