sitijaafar
asked on
Cannot find the user 'admin', because it does not exist or you do not have permission.
Hi all,
I want to grant SELECT permission for admin user using the below command:
grant SELECT on dbo.audit_trail to [admin];
But the problem is I got this error message:
Cannot find the user 'admin', because it does not exist or you do not have permission.
I want to grant SELECT permission for admin user using the below command:
grant SELECT on dbo.audit_trail to [admin];
But the problem is I got this error message:
Cannot find the user 'admin', because it does not exist or you do not have permission.
ASKER
Yes, I already create the admin user, I'm using sql server authentication.
Seems like you have created Admin login alone and not user admin for your database.
Run this statement in your database and then check:
-- Run this statement if login doesn't exists
CREATE LOGIN admin WITH PASSWORD = 'pass@123';
USE ur_db_name;
CREATE USER admin ;
GO
Run this statement in your database and then check:
-- Run this statement if login doesn't exists
CREATE LOGIN admin WITH PASSWORD = 'pass@123';
USE ur_db_name;
CREATE USER admin ;
GO
ASKER
I run the above statement and I got the below message:
Msg 15025, Level 16, State 1, Line 2
The server principal 'admin' already exists.
Msg 15063, Level 16, State 1, Line 4
The login already has an account under a different user name.
Msg 15025, Level 16, State 1, Line 2
The server principal 'admin' already exists.
Msg 15063, Level 16, State 1, Line 4
The login already has an account under a different user name.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When I go to database mapping and uncheck for the database and click ok. It prompt below message:
Is it my ms sql have a problem?
error.JPG
Is it my ms sql have a problem?
error.JPG
ASKER
I already can solve the error using the
sp_changedbowner sa
and able to uncheck for the database for admin. I also Try granting the SELECT permission again and it's work. Thanks.
sp_changedbowner sa
and able to uncheck for the database for admin. I also Try granting the SELECT permission again and it's work. Thanks.
Glad to see you fixed it..
ASKER
Thanks rrjegan17.
Welcome..
are you talking about windows authentication?