cannot login to sql server with new user created

爷,独闯天下 提交于 2021-02-19 03:56:08

问题


I created a login named logintest (SQL Authentication) then i created a user named usertest with this login

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

Cannot connect to SARAH.

Login failed for user 'usertest'. (Microsoft SQL Server, Error: 18456)


回答1:


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

Then make sure the password is correct and that guest user is enabled on master database.



来源:https://stackoverflow.com/questions/43676698/cannot-login-to-sql-server-with-new-user-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!