I'm trying to connect to a database using Windows Authentication. I believe that my current user does not have access to it.
我正在尝试使用Windows身份验证连接到数据库。我相信我当前的用户无法访问它。
How can I enable a user to login to SQL Server, and use the database?
如何让用户登录到SQL Server并使用数据库?
2 个解决方案
#1
4
You need to use the SQL Server Management Studio program to grant access for the user. You'll need to connect in with a login that has administration privileges for the database. If you have don't have those privileges you'll need to contact someone that does.
您需要使用SQL Server Management Studio程序为用户授予访问权限。您需要使用具有数据库管理权限的登录名进行连接。如果您没有这些权限,则需要联系某人。
If you do have a login with those privileges, open Management Studio, connect to the database server the database is on and look for the Security node in Object Explorer. Expand the Security node and look for the name of the user in the list of Logins. The user's name should be the same as the user's Windows login if you are using Windows Authentication (DOMAIN\Username format). If the user is there, you will need to grant that user appropriate permissions to the database (read, execute SPs, etc.). If the user isn't there you will need to add them. Permission can also be added by group so you should check for groups that the user belongs to as well.
如果您确实具有具有这些权限的登录名,请打开Management Studio,连接到数据库所在的数据库服务器,并在对象资源管理器中查找“安全性”节点。展开“安全性”节点,然后在“登录”列表中查找用户的名称。如果您使用Windows身份验证(DOMAIN \用户名格式),则用户的名称应与用户的Windows登录名相同。如果用户在那里,您将需要向该用户授予对数据库的适当权限(读取,执行SP等)。如果用户不在那里,您将需要添加它们。权限也可以按组添加,因此您应该检查用户所属的组。
#2
3
I had a scenario where I inherited a PC from another developer that left the organization. I couldn't access the default instance using Windows Authentication.
我有一个场景,我从另一个离开组织的开发人员那里继承了一台PC。我无法使用Windows身份验证访问默认实例。
Here was the solution:
这是解决方案:
- Open up SQL Server Configuration Manager
- Click on "SQL Server Services"
- Locate the Instance in the right pane and double-click for its properties
- In the "Log On" tab, notice the "Log on as:" radio button option is set to "Built-in account".
- Change the option to "This account" and add your Windows Authentication account with your domain and username and enter your password.
- Click "Apply". Click "Yes" when it asks you if you want to restart the instance.
打开SQL Server配置管理器
单击“SQL Server服务”
在右侧窗格中找到实例,然后双击其属性
在“登录”选项卡中,注意“登录为:”单选按钮选项设置为“内置帐户”。
将选项更改为“此帐户”,并使用您的域和用户名添加Windows身份验证帐户,然后输入您的密码。
单击“应用”。当它询问您是否要重新启动实例时,单击“是”。
This will automatically add your Windows Authentication user account (Active Directory or local user) to the SQL Server instance. You will now be able to connect right away to the selected instance. As best practice, reset the settings back to the Built-in user account (most likely Network Service).
这将自动将您的Windows身份验证用户帐户(Active Directory或本地用户)添加到SQL Server实例。您现在可以立即连接到所选实例。最佳做法是将设置重置为内置用户帐户(最可能是网络服务)。
That's it!
#1
4
You need to use the SQL Server Management Studio program to grant access for the user. You'll need to connect in with a login that has administration privileges for the database. If you have don't have those privileges you'll need to contact someone that does.
您需要使用SQL Server Management Studio程序为用户授予访问权限。您需要使用具有数据库管理权限的登录名进行连接。如果您没有这些权限,则需要联系某人。
If you do have a login with those privileges, open Management Studio, connect to the database server the database is on and look for the Security node in Object Explorer. Expand the Security node and look for the name of the user in the list of Logins. The user's name should be the same as the user's Windows login if you are using Windows Authentication (DOMAIN\Username format). If the user is there, you will need to grant that user appropriate permissions to the database (read, execute SPs, etc.). If the user isn't there you will need to add them. Permission can also be added by group so you should check for groups that the user belongs to as well.
如果您确实具有具有这些权限的登录名,请打开Management Studio,连接到数据库所在的数据库服务器,并在对象资源管理器中查找“安全性”节点。展开“安全性”节点,然后在“登录”列表中查找用户的名称。如果您使用Windows身份验证(DOMAIN \用户名格式),则用户的名称应与用户的Windows登录名相同。如果用户在那里,您将需要向该用户授予对数据库的适当权限(读取,执行SP等)。如果用户不在那里,您将需要添加它们。权限也可以按组添加,因此您应该检查用户所属的组。
#2
3
I had a scenario where I inherited a PC from another developer that left the organization. I couldn't access the default instance using Windows Authentication.
我有一个场景,我从另一个离开组织的开发人员那里继承了一台PC。我无法使用Windows身份验证访问默认实例。
Here was the solution:
这是解决方案:
- Open up SQL Server Configuration Manager
- Click on "SQL Server Services"
- Locate the Instance in the right pane and double-click for its properties
- In the "Log On" tab, notice the "Log on as:" radio button option is set to "Built-in account".
- Change the option to "This account" and add your Windows Authentication account with your domain and username and enter your password.
- Click "Apply". Click "Yes" when it asks you if you want to restart the instance.
打开SQL Server配置管理器
单击“SQL Server服务”
在右侧窗格中找到实例,然后双击其属性
在“登录”选项卡中,注意“登录为:”单选按钮选项设置为“内置帐户”。
将选项更改为“此帐户”,并使用您的域和用户名添加Windows身份验证帐户,然后输入您的密码。
单击“应用”。当它询问您是否要重新启动实例时,单击“是”。
This will automatically add your Windows Authentication user account (Active Directory or local user) to the SQL Server instance. You will now be able to connect right away to the selected instance. As best practice, reset the settings back to the Built-in user account (most likely Network Service).
这将自动将您的Windows身份验证用户帐户(Active Directory或本地用户)添加到SQL Server实例。您现在可以立即连接到所选实例。最佳做法是将设置重置为内置用户帐户(最可能是网络服务)。
That's it!