Link to home
Start Free TrialLog in
Avatar of sitijaafar
sitijaafarFlag for Malaysia

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.
Avatar of RiteshShah
RiteshShah
Flag of India image

have you created "Admin" login/user yourself? as in SQL Server, master login is "SA" not login ships with SQL Server such as "Admin".

are you talking about windows authentication?
Avatar of sitijaafar

ASKER

Yes, I already create the admin user,  I'm using sql server authentication.
Avatar of Raja Jegan R
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
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.
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.

Glad to see you fixed it..
Thanks rrjegan17.
Welcome..