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)