正确设置MSSQL 2012的sa帐户。无法登录

时间:2013-08-14 17:33:20

标签: sql-server-2008 sql-server-2012 windows-authentication sa

我按照许多教程中的建议在SQL Server 2012上进行了以下设置:

  • 我将服务器身份验证设置为“SQL Server和Windows身份验证模式”
  • 我使用强制密码策略设置了一个强密码,默认数据库为“master”给SA用户
  • 我授予SA用户连接数据库引擎的权限 启用了他的登录信息。

但是当我尝试登录“localhost”时 通过SQL Server身份验证。

它失败了:

Cannot connect to (local).
------------------------------
Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)

我唯一可以登录的方法仍然是Window身份验证。

我的实例名为MSSQLSERVER。 localhost \ MSSQLSERVER无法访问。

1 个答案:

答案 0 :(得分: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 SQL Server as a member of the local administrators 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 valid login, but server access failed.
18    Password must be changed.

详细信息 - MSDN