How to use the MySQL Grant command (detailed)

Source: Internet
Author: User

Basic format of the grant command

1 Grant  on  to User

Example one: Common_user users who log in at any IP address can query operations, insert operations, update operations, delete operations on data in the TestDB database

1 Grant Select  onTestDB.*  to[Email protected]'%'// have permission to query data  2 Grant Insert  onTestDB.*  to[Email protected]'%'// permissions for data discrepancies  3 Grant Update  onTestDB.*  to[Email protected]'%'// have permission to update data  4 Grant Delete  onTestDB.*  to[Email protected]'%'// have permission to delete data  

The above command is equivalent to the following command.

Grant Select,insert,update,delete on TestDB. *  to [Email protected] '%'  

Example two: In IP for 192.168.0.1 to 192.168.0.255 Login Developer User can create, modify, delete the tables in the TestDB database

1 Grant Create  onTestDB.*  to[Email protected]'192.168.0.%';//have permissions to create tables2 Grant Alter   onTestDB.*  to[Email protected]'192.168.0.%';//have permission to modify a table3 Grant Drop    onTestDB.*  to[Email protected]'192.168.0.%';//have permission to delete table

How to use the MySQL Grant command (detailed)

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.