[英]Unable to log in to server in SQL Server 2008 R2 Management Studio
I have a SQL Server 2008 R2 instance and can log in using the sa
user. 我有一个SQL Server 2008 R2实例,可以使用
sa
用户登录。 But I want to define another user ( administrator
) to log in with SQL Server Management Studio, so I did the following: 但我想定义另一个用户(
administrator
)使用SQL Server Management Studio登录,因此我执行了以下操作:
sa
. sa
身份登录Management Studio中的服务器。 administrator
). administrator
)。 But when I tried to log in using administrator
, I got the following error: 但是当我尝试使用
administrator
登录时,我收到以下错误:
Login failed for user “administator” Error 18456.
用户“administator”登录失败错误18456。
Can anyone advise what might be the problem? 任何人都可以建议可能是什么问题?
If the server encounters an error that prevents a login from succeeding, the client will display the following error mesage. 如果服务器遇到阻止登录成功的错误,则客户端将显示以下错误消息。
Msg 18456, Level 14, State 1, Server <server name>, Line 1
Login failed for user '<user name>'
Invalid userID: SQL Server is not able to find the specified UserID on the server you are trying to get. 无效的用户标识: SQL Server无法在您尝试获取的服务器上找到指定的用户标识 。 The most common cause is that this userID hasn't been granted access on the server but this could be also a simple typo or you accidentally are trying to connect to different server (Typical if you use more than one server)
最常见的原因是此userID尚未被授予服务器访问权限,但这也可能是一个简单的错误或您不小心尝试连接到不同的服务器(如果您使用多个服务器,则典型)
Invalid password: Wrong password or just a typo. 密码无效:密码错误或只是拼写错误。 Remember that this username can have different passwords on different servers.
请记住,此用户名可以在不同服务器上具有不同的密码
less common errors: The userID might be disabled on the server. 不太常见的错误:可能在服务器上禁用了userID。 Windows login was provided for SQL Authentication (change to Windows Authentication. If you use SSMS you might have to run as different user to use this option).
为SQL身份验证提供了Windows登录(更改为Windows身份验证。如果使用SSMS,则可能必须以不同的用户身份运行才能使用此选项)。 Password might have expired and probably several other reasons….
密码可能已过期,可能还有其他几个原因....
18456 state 1 explanations: Usually Microsoft SQL Server will give you error state 1 which actually does not mean anything apart from that you have 18456 error. 18456状态1解释:通常Microsoft SQL Server将为您提供错误状态1,除了您有18456错误之外,实际上并不意味着什么。 State 1 is used to hide actual state in order to protect the system, which to me makes sense.
状态1用于隐藏实际状态以保护系统,这对我来说是有意义的。 Below is a list with all different states and for more information about retrieving accurate states visit Understanding "login failed" (Error 18456) error messages in SQL Server 2005
下面是包含所有不同状态的列表,有关检索准确状态的详细信息,请访问SQL Server 2005中的了解“登录失败”(错误18456)错误消息
SQL Authentication not enabled: If you use SQL Login for the first time on SQL Server instance than very often error 18456 occurs because Windows Authentication (only) is set in Server properties (security section). SQL身份验证未启用:如果您第一次在SQL Server实例上使用SQL登录,则通常会出现错误18456,因为在服务器属性(安全性部分)中设置了Windows身份验证(仅限)。
To Access Server Properties, - Open SQL Server Management Studio, go to Object Explorer pane (use view if you can't see it). 要访问服务器属性, - 打开SQL Server Management Studio,转到“对象资源管理器”窗格(如果看不到,请使用视图)。 - Use the connect button to connect to database engine for your server.
- 使用连接按钮连接到服务器的数据库引擎。 Once connected you will see it in object explorer.
连接后,您将在对象资源管理器中看到它。 - Right click server and click properties.
- 右键单击服务器并单击属性。 Server Properties window will appear.
将出现“服务器属性”窗口
See below screenshot that might be causing SQL login to fail 请参阅下面可能导致SQL登录失败的屏幕截图
You should set Server Authentication to SQL Server Windows Authentication 您应将服务器身份验证设置为SQL Server Windows身份验证
To resolve this error follow the steps below on computer with SQL Server 2005. 若要解决此错误,请按照下面的计算机与SQL Server 2005中的步骤。
How to fix? 怎么修? Check this link video SQL Server and Windows Authentication Mode page.
检查此链接视频SQL Server和Windows身份验证模式页面。
You need to add a server login : 您需要添加服务器登录 :
sa
. sa
身份连接到SQL Server。 You may need to add a database user depending on your needs, but a server login (like your sa
login) is necessary to connect to the SQL Server instance using Windows or SQL Server authentication. 您可能需要根据需要添加数据库用户,但是使用Windows或SQL Server身份验证连接到SQL Server实例需要服务器登录(如
sa
登录)。 Mapping the new login to a database user (in the Login - New dialog's User Mappings page) will create a new user in the mapped database if you specify a username that does not already exist; 如果指定了尚不存在的用户名,则将新登录映射到数据库用户 (在“ 登录 - 新建”对话框的“ 用户映射”页面中)将在映射数据库中创建新用户; alternatively you can map the new login to an existing database user.
或者,您可以将新登录映射到现有数据库用户。
Another SO question speaks to the differences between server logins and database users. 另一个问题是服务器登录和数据库用户之间的差异。
or 要么
or 要么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.