MySQL to the user to add library operation rights

Source: Internet
Author: User
Tags dba mysql view

To increase user action rights

Grant all privileges in ' db_name '. * to ' user_name ' @ ' HOST ' with GRANT OPTION;


Grant normal data user, the right to query, insert, UPDATE, and delete all table data in the database.

Grant SELECT on testdb.* to common_user@ '% '
Grant insert on testdb.* to common_user@ '% '
Grant update on testdb.* to common_user@ '% '
Grant Delete on testdb.* to common_user@ '% '

Alternatively, replace it with a MySQL command:

Grant SELECT, INSERT, UPDATE, delete on testdb.* to common_user@ '% '


1. Grant functions on the entire MySQL server:

Grant SELECT on *.* to Dba@localhost; --The DBA can query the tables in all databases in MySQL.
Grant all on *.* to Dba@localhost; --DBA can manage all databases in MySQL

2. Grant functions on a single database:

Grant SELECT on testdb.* to Dba@localhost; --DBAs can query the tables in TestDB.

3. Grant functions on a single datasheet:

Grant SELECT, INSERT, UPDATE, delete on testdb.orders to Dba@localhost;

4. Grant acts on the columns in the table:

Grant Select (ID, SE, rank) on Testdb.apache_log to Dba@localhost;

5. Grant functions on stored procedures, functions:

Grant execute on procedure testdb.pr_add to ' dba ' @ ' localhost '
Grant execute on function testdb.fn_add to ' dba ' @ ' localhost '


Grant Database Developer, create tables, indexes, views, stored procedures, functions ... and other permissions.
Grant creates, modifies, and deletes MySQL data table structure permissions.
Grant create on testdb.* to developer@ ' 192.168.0.% ';
Grant alter on testdb.* to developer@ ' 192.168.0.% ';
Grant drop on testdb.* to developer@ ' 192.168.0.% ';

Grant operates MySQL foreign key permissions.
Grant references on testdb.* to developer@ ' 192.168.0.% ';

Grant operates the MySQL temporary table permission.
Grant create temporary tables on testdb.* to developer@ ' 192.168.0.% ';

Grant operates MySQL indexing permissions.
Grant index on testdb.* to developer@ ' 192.168.0.% ';

Grant operates the MySQL view and views the view source code permissions.
Grant CREATE view on testdb.* to developer@ ' 192.168.0.% ';
Grant Show view on testdb.* to developer@ ' 192.168.0.% ';

Grant operates MySQL stored procedures, function permissions.
Grant create routine on testdb.* to developer@ ' 192.168.0.% '; --now, can show procedure status
Grant alter routine on testdb.* to developer@ ' 192.168.0.% '; --now, can drop a procedure
Grant execute on testdb.* to developer@ ' 192.168.0.% ';

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.