MySQL permissions control is mainly through the MySQL library under the Db,user,host,table_priv,column_priv Table control.
Because of the small amount of permission information data, MySQL loads all permission messages into memory at startup. So each time you manually modify the relevant permission table, you need to reload it by using the flush privileges command. However, if it is through grant,revoke or drop user,create user commands such as Modify permissions, you do not need to flush MySQL in a total of five levels of permissions, in order of size: Global > Database > Table > column, routine level is the ① of the stored procedure or function operation, global level control, and all permission information is stored in the Mysql.user table. The Global level is for the entire mysqld. Grant Select,create table on *. * to U1 identified by password; ②, the database level scope specifies all objects in the entire database. Grant Select,create table on databasename.* to U1 identified by password; User Database1;grant drop on * to ' U1 ' @ '% ', ' U1 ' @localhost, [email protected] '% '; The ③,table level scope is a specific table under the specified user, grant index on TEST.T1 to ' U1 ' @localhost ④, and the column level scope is certain columns in a specific table under a specific library. The column-level permissions are insert,select,update. Authorization method: Grant Select (C1,C2,C3) on test.t1 to ' U1 ' @localhost; ⑤, Routine levelroutine level of the permissions mainly only execute and alter Routine two, mainly for the object is procedure and function of the two objects, when authorized Routine level permissions, You need to specify the database and related objects. Grant execute on TEST.P1 to ' U1 '% ';
Summary of level five permissions in MySQL