Antoine
Antoine

Reputation: 13

MySQL give user privileges without having them

My problem is the following:

I have my root user with all privileges on my MySQL Server. I create a bob user for the example. Then, I give bob the privilege, with my root user, to create other users.

My question is: is there a way to give bob the privilege to give certain privileges to its newly-created users but without giving bob these privileges?

I hope the question is clear and my English as well. Thank you in advance.

Upvotes: 0

Views: 472

Answers (2)

Shadow
Shadow

Reputation: 34294

No, a user account must have both the grant privilege and the privileges it wants to grant in order for the grant statement to succeed. What you want would present a huge security risk!

Upvotes: 1

Mark B
Mark B

Reputation: 682

The answer is in the documentation, https://dev.mysql.com/doc/refman/8.0/en/grant.html

"To grant a privilege with GRANT, you must have the GRANT OPTION privilege, and you must have the privileges that you are granting. (Alternatively, if you have the UPDATE privilege for the grant tables in the mysql system schema, you can grant any account any privilege.) When the read_only system variable is enabled, GRANT additionally requires the CONNECTION_ADMIN privilege (or the deprecated SUPER privilege). "

Upvotes: 1

Related Questions