/*授予用户通过外网IP对于该数据库的全部权限*/

grant all privileges on `test`.* to 'test'@'%' ;

/*授予用户在本地服务器对该数据库的全部权限*/

grant all privileges on `test`.* to 'test'@'localhost';

grant select on test.* to 'user1'@'localhost'; /*给予查询权限*/

grant insert on test.* to 'user1'@'localhost'; /*添加插入权限*/

grant delete on test.* to 'user1'@'localhost'; /*添加删除权限*/

grant update on test.* to 'user1'@'localhost'; /*添加权限*/

  flush privileges; /*刷新权限*/



(6)查看权限



show grants;

(7)删除权限

revoke privileges on databasename.tablename from 'username'@'host';
grant select,insert,update,delete,create on [数据库名称].* to [用户名称];--用户授权数据库