Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of the grant command in mysql

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about the role of the grant command in mysql, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

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 a procedure

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 server:

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

After reading the above, do you have any further understanding of the function of the grant command in mysql? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report