无法使用创建的新用户登录sql服务器 [英] cannot login to sql server with new user created
问题描述
我创建了一个名为 logintest (SQL身份验证)的登录名,然后使用此登录名创建了一个名为 usertest 的用户
I created a login named logintest (SQL Authentication) then i created a user named usertest with this login
用户创建成功,并且我将身份验证模式更改为混合模式,并且还重新启动了SQLSERVERAGENT和MSSQLSERVER服务
the user creation is successful, And i changed the authentication mode to mixed mode and also restarted the services SQLSERVERAGENT and MSSQLSERVER
并且当我尝试使用创建的新用户登录时仍然出现此错误
and still this error appear when i try to login with the new user created
无法连接到SARAH.
Cannot connect to SARAH.
用户'usertest'登录失败.(Microsoft SQL Server,错误:18456)
Login failed for user 'usertest'. (Microsoft SQL Server, Error: 18456)
推荐答案
登录名必须具有 CONNECT
权限.
必须启用登录.
链接到登录名的默认数据库必须是该登录名具有连接权限的数据库(例如,默认情况下, master
数据库为 guest
用户授予连接权限)./p>
The login must have CONNECT
right given.
The login must be enabled.
The default database linked to the login must be a database to which the login has rights to connect (for example by default master
database gives rights to guest
user to connect).
USE [master]
GO
ALTER LOGIN [logintest] WITH DEFAULT_DATABASE=[master]
GO
GRANT CONNECT SQL TO [logintest]
GO
ALTER LOGIN [logintest] ENABLE
GO
然后确保密码正确,并且在 master
数据库上启用了 guest
用户.
Then make sure the password is correct and that guest
user is enabled on master
database.
这篇关于无法使用创建的新用户登录sql服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!