First off let me state that I'm not a DBA, I don't have access to a DBA, I'm just a programmer who has to get a CMS working. I'm generally pretty good at getting random servers working, but this is doing my head in.

I have a trail of SQL Server 2008 installed, with a database that I imported from a backup. The CMS starts up, connects to the DB but tells me

[SqlException (0x80131904): Login failed for user 'kentico'.]

Checking the logs shows me

Error: 18456, Severity: 14, State: 12.

I googled it, and every answer has state 11 and 12 in lumped together, and I think I've done what is mentioned in the posts. but really im just stumbling in the dark. I don't even know what other information I can provide that will help people help me!

I have created a user in in the \security\logins folder, and this login is mapped to a user of the same name in the \databases\<db_name>\security\ folder. What else do I have to do?!

I should say that changing the connection string to the sa account gets me in to the cms, but then I'm only allowed one connection on the sa account so the CMS randomly spits the dummy when the connection is refused.

Any help would be greatly appreciated, and please remember, this is my first time I've even looked at SQL Server, so the assumed knowledge is just not there :(

2 Answers 2


SQL Server operates in 2 security modes: "Windows" or "Mixed"

Ensure you are set to "Mixed" as per this MSDN article: How to: Change Server Authentication Mode

The clue is in the error:

  • Login failed for user 'kentico' is not the same as Login failed for user 'DOMAIN\kentico' which means a SQL login (not Windows)
  • Error 18456 is for Windows logins

Ergo, your mode is wrong...

Our very own Aaron Bertrand has a good article on the error 18456 states

  • sorry, pressed enter. I didnt realise that would post the comment.The server authentication mode already is "SQL Server and Windows Authentication Mode". So are you saying that it should be windows authentication? I've already read the page you linked to. My error is state 12, but the "reason" in my logs is "login based", not "token based" as that page says. I need to reboot to see if the problem was UAC. if that doesnt help im back to square one. thanks again for your response. Sep 21, 2011 at 0:38

Error 18456 State 12 Means that the Login is a valid login, but server access failed. Check this link for a summary : Troubleshooting: Login failed for user 'x'

As I understand, you restored the database from a backup, this means that you did recreate the login in your environment but the database login and the database user may not be linked correctly.

Try running :

ALTER user KENTICO with login = Kentico

You can check the database role from the User Mapping page , on the Login properties. At the database level you must have at least the "Connect SQL" Permission for the Kentico User (highlight your server name in SSMS, click properties, then the permission page).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.