Ryan Ward Ryan Ward - 3 years ago 137
MySQL Question

If a user is root in a database, am I right in thinking that user can't also have revoked permissions

If a user is root in a database, am I right in thinking that user can't also have revoked permissions. For Example, say the user is root and another root revokes their write privilege. Will the first root still be able to write to the database?

Answer Source

If the database is MySQL, then no.

root is just a name, but is often associated with a user that has full privileges, like in your case i assume. That means, there can be more users that have the same, or less privileges as your root user. This is also recommended because not every user needs every privilege.

And users can grant or revoke each others privileges if they can. Be careful because you can also revoke your own and lock yourself out.

Here is an example of a user that has full privileges on all db's, with grant and revoke:

mysql> CREATE USER 'admin'@'localhost' IDENTIFIED BY 'pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
mysql> CREATE USER 'admin'@'%' IDENTIFIED BY 'pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download