简体   繁体   English

无法登录SQL Server 2008 R2 Management Studio中的服务器

[英]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登录,因此我执行了以下操作:

  • Logged in to the server in Management Studio as sa . sa身份登录Management Studio中的服务器。
  • Right clicked on the database name. 右键单击数据库名称。
  • Clicked on properties. 点击属性。
  • Then under permission, I select the required username ( administrator ). 然后在许可下,我选择所需的用户名( administrator )。
  • And I grant him all the permission. 我授予他所有许可。

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>'
  • This usually means that your connection request was successfully received by the server name you specified but the server is not able to grant you access for a number of reasons and throws error: 18456. 这通常意味着您指定的服务器名称已成功接收到您的连接请求,但服务器由于多种原因无法授予您访问权限并抛出错误:18456。
  • This eventID sometimes provides also state 1 which actually isn't that useful as due to security reasons any error is converted to state 1 unless you can check logging on the server. 此eventID有时也提供状态1实际上没有用,因为出于安全原因,任何错误都转换为状态1,除非您可以检查服务器上的日志记录。
  • Microsoft does not provide very useful message boxes so below are some explanations why you get the error. Microsoft没有提供非常有用的消息框,因此下面是一些解释为什么会出现错误。

在此输入图像描述

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中的步骤。

  • Create new user with Administrator privilege with same username and password as of SQL Server 2008 in operating system. 使用与操作系统中的SQL Server 2008相同的用户名和密码创建具有管理员权限的新用户。
  • On SQL Server database create new user by expanding DatabaseNode >> Security >> Login >> - Create New User and add this new user with Windows Authentication radio button selected. 在SQL Server数据库上通过展开DatabaseNode创建新用户>>安全>>登录>> - 创建新用户并添加此新用户并选择Windows身份验证单选按钮。 - This user can be only added by selected Windows Authentication it is Operating system's User Login. - 此用户只能通过选定的Windows身份验证添加它是操作系统的用户登录。
  • Once above two steps are completed when connected from SQL Server 2008 to SQL Server 2005 using Windows Authentication it will connect successfully. 使用Windows身份验证从SQL Server 2008连接到SQL Server 2005后,完成上述两个步骤后,它将成功连接。

How to fix? 怎么修? Check this link video SQL Server and Windows Authentication Mode page. 检查此链接视频SQL Server和Windows身份验证模式页面。

Source 资源

You need to add a server login : 您需要添加服务器登录

  1. Connect to your SQL Server with SSMS as sa . 使用SSMS以sa身份连接到SQL Server。
  2. Drill into the server's Security folder in SSMS's Object Explorer pane. 在SSMS的对象资源管理器窗格中深入查看服务器的Security文件夹。
  3. Right-click on the server's Security > Logins folder that appears in Object Explorer . 右键单击对象资源管理器中显示的服务器的Security > Logins文件夹。
  4. Click on New Login... in the context menu that appears. 在出现的上下文菜单中单击“ 新建登录... ”。
  5. Provide details of the new login in the Login - New dialog that opens - particularly its General , Server Roles , and User Mappings pages (along the left). Login - New对话框中提供新登录的详细信息 - 特别是其GeneralServer RolesUser Mappings页面(左侧)。 (See the screenshots of each page with sample input at the bottom of the answer.) (请参阅答案底部带有示例输入的每页的屏幕截图。)

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. 另一个问题是服务器登录和数据库用户之间的差异。

Login - New (General page) 登录 - 新(常规页面)

SQL Server authentication SQL Server身份验证

登录 - 新建(常规,SQL身份验证)

or 要么

Windows authentication Windows身份验证

登录 - 新(常规,Win auth)

Login - New (Server Roles page) 登录 - 新建(服务器角色页面)

登录 - 新(服务器角色)

Login - New (User Mappings page) 登录 - 新建(用户映射页面)

SQL Server authentication SQL Server身份验证

登录 - 新建(用户映射,SQL身份验证)

or 要么

Windows authentication Windows身份验证

登录 - 新(用户映射,Win auth)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用Management Studio连接到SQL Server 2008 R2实例 - Unable to connect to SQL Server 2008 R2 instance with management studio 无法从服务器资源管理器,SQL Server 2008 R2 Management Studio等连接到远程数据库 - Unable to connect to remote databases from server explorer, sql server 2008 r2 management studio and others SQL Server Management Studio Express 2005至2008 R2 - SQL Server Management Studio Express 2005 to 2008 R2 找不到SQL Server R2 2008开发人员版的Management Studio - Management Studio not found for SQL Server R2 2008 Developer Edition SQL Server Management Studio 2008 R2 中的查询分析器在哪里? - Where is the Query Analyzer in SQL Server Management Studio 2008 R2? SQL Server 2008 R2 Management Studio错误 - SQL Server 2008 R2 Management Studio errors 无法使用Management Studio连接到SQL Server 2008 R2 - Cannot connect to SQL Server 2008 R2 with Management studio SQL Server 2008 r2 Management Studio 问题 - SQL Server 2008 r2 Management Studio problems 无法使用Liferay 6.2连接MS SQL Server Management Studio 2008 R2 - Unable to connect with MS SQL Server management studio 2008 r2 with Liferay 6.2 无法在 SQL Server Management Studio 2008 R2 登录中更改用户名 - Unable tochange user name in SQL Server Management Studio 2008 R2 Login
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM