Get the App
SLTechnology News&Howtos  ›  Database  › 

Authorization restrictions for mysql grant commands

Shulou Source: shulou.com Published: 2022-06-01 18:48:28 10月27日 Update

The following mainly brings you the authorization restrictions of the mysql grant command. I hope these contents can bring you practical use, which is also the main purpose of this article when I edit the authorization restrictions of the mysql grant command. All right, don't talk too much nonsense, let's just read the following.

Grant permissions on object to user

Grant ordinary data users have the right to query, insert, update and delete all table data in the database.

Grant select on testdb.* to

Grant insert on testdb.* to

Grant update on testdb.* to

Grant delete on testdb.* to

Or, replace it with a MySQL command:

Grant select, insert, update, delete on testdb.* to

Second, grant database developers, create tables, indexes, views, stored procedures, functions. Wait for permission.

Grant creates, modifies, and deletes MySQL data table structure permissions.

Grant create on testdb.* to

Grant alter on testdb.* to

Grant drop on testdb.* to

Grant manipulates MySQL foreign key permissions.

Grant references on testdb.* to

Grant manipulates MySQL temporary table permissions.

Grant create temporary tables on testdb.* to

Grant manipulates MySQL index permissions.

Grant index on testdb.* to

Grant manipulates MySQL view and view view source code permissions.

Grant create view on testdb.* to

Grant show view on testdb.* to

Grant manipulates MySQL stored procedures and function permissions.

Grant create routine on testdb.* to;-- now, can show procedure status

Grant alter routine on testdb.* to;-- now, you can drop aprocedure

Grant execute on testdb.* to

Third, the permission of grant ordinary DBA to manage a MySQL database.

Grant all privileges on testdb to

The keyword "privileges" can be omitted.

4. Grant Advanced DBA manages the permissions of all databases in MySQL.

Grant all on *. * to

Fifth, MySQL grant permissions, which can be used at multiple levels.

1. Grant acts on the entire MySQL CVM:

Grant select on *. * to;-- dba can query tables in all databases in MySQL.

Grant all on *. * to;-- dba can manage all databases in MySQL

2. Grant acts on a single database:

Grant select on testdb.* to;-- dba can query tables in testdb.

3. Grant acts on a single data table:

Grant select, insert, update, delete on testdb.orders to

4. Grant acts on the columns in the table:

Grant select (id, se, rank) on testdb.apache_log to

5. Grant acts on stored procedures and functions:

Grant execute on procedure testdb.pr_add to

Grant execute on function testdb.fn_add to

6. View MySQL user permissions

View current user (own) permissions:

Show grants

View additional MySQL user rights:

Show grants for

Revoke the permissions that have been granted to MySQL users.

The syntax of revoke is similar to that of grant, except that you can replace the keyword "to" with "from":

Grant all on *. * to

Revoke all on *. * from

VIII. Considerations for user rights of MySQL grant and revoke

1. After the grant, revoke user permission, the user will not take effect until the user reconnects to the MySQL database. two。 If you want authorized users, you can also grant these permissions to other users. You need the option "grant option".

Grant select on testdb.* to with grant option

This feature is generally not needed. In practice, database permissions are best managed by DBA.

For the above authorization restrictions on the mysql grant command, you do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Tags: Permissions data users databases roles commands management restrictions content functions views procedures storage queries normal following keywords individual actual Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB NVidia Shulou Technology Apple MySQL