Hi,

1. Just am created a user for the login 'test'.
2. As with this login 'test', i logined to the server.
3. I don't have the permission to create the database.
4. So i tried this query:

use master
          grant create any database to user
          go

5. Am facing this following error: why ?

Msg 4613, Level 16, State 1, Line 2
          Grantor does not have GRANT permission.

6. please help me out. Thanks in advance.

Dani AI

Generated

The error means you tried to run GRANT as a principal that is not allowed to grant server‑level permissions. Only a principal that already has the permission WITH GRANT OPTION, a higher permission that implies it (for example CONTROL SERVER), or a member of sysadmin can grant it. Also note that server‑scope permissions must be granted while your context is master. In short: do not run the GRANT as the new login itself. GRANT Server Permissions (Transact‑SQL).

Two safe ways to fix this (connect using a sysadmin or an admin with CONTROL SERVER):

-- Least privilege: allow only creating databases
USE master;
GRANT CREATE ANY DATABASE TO [test];
-- Broader: role also allows alter/drop/restore any database
ALTER SERVER ROLE [dbcreator] ADD MEMBER [test];

Prefer the first if all you need is create; dbcreator is powerful and may be more than you intend. Server-level roles (dbcreator and securityadmin notes).

A couple of gotchas I often see in cases like this:

  • Grant server permissions to a login or server role, not to a database user. Your target should be [test] (the login), not a user in a database. GRANT Server Permissions (Transact‑SQL).
  • is right that you must run the GRANT as an admin, but in SQL Server the role name is sysadmin (not Oracle’s sysdba). If you do use securityadmin, be aware it can grant most server permissions and should be treated as highly privileged. Server-level roles.

Quick check:

SELECT p.name, perm.permission_name
FROM sys.server_permissions AS perm
JOIN sys.server_principals AS p ON p.principal_id = perm.grantee_principal_id
WHERE p.name = N'test';

The user you created did not get permission to GRANT permissions to other users. Login as sysdba and try the GRANT query again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.