create  user  'gogs' @'127.0.0.1'  IDENTIFIED WITH  mysql_native_password by  'IjaGo@GsNl2' ; 
grant  SELECT ,  INSERT ,  UPDATE ,  DELETE ,  CREATE ,  ALTER ,  DROP ,  INDEX ,  CREATE  VIEW ,  SHOW  VIEW ,  CREATE  TEMPORARY  TABLES  on  gogs. *  to  'gogs' @'127.0.0.1' ; flush privileges ; 
mysql>  create  user  'test2' @'%'  identified by  '123456' ; 
Query OK,  0  rows  affected ( 0.01  sec) 
create  user  'username' @'ip'  IDENTIFIED by  'password' ; 
alter  user  'username' @'ip'  IDENTIFIED WITH  mysql_native_password by  'password' ; 
create  user  'username' @'ip'  IDENTIFIED WITH  mysql_native_password by  'password' ; 
mysql>  show  grants for  'test2' @'%' ; 
+ 
|  Grants for  test2@%                 | 
+ 
|  GRANT  USAGE  ON  * . *  TO  ` test2` @`%`  | 
+ 
1  row  in  set  ( 0.04  sec) 
revoke  select  on  * . *  from  'test2' @'%' ; 
revoke  all  on  * . *  from  'username' @'ip' ; 
flush privileges ; 
set  password for  'username' @'ip' = 'new_password' ; 
rename  user  'username' @'ip'  to  'new_username' @'new_ip' ; 
drop  user  'username' @'ip' ; drop  user  'test2' @'localhost' ; 
ALL[PRIVILEGES] 所有特权 ALTER 允许使用ALTER TABLE语句更改表的结构 CREATE 允许使用创建新库和表 CREATE USER 允许使用创,删,改用户的语句 DELETE 允许删除表中记录 DROP 允许删除库,表,视图 EVENT 允许使用事务,并且可以在事务中增删改查 GRANT OPTION 允许授予自己拥有的特权或从其他用户撤消特权 INDEX 允许使用创建或删除索引的语句 INSERT 允许在表中插入数据 RELOAD 允许使用FLUSH语句,flush-logs等 REPLICATION CLIENT 允许使用的SHOW MASTER STATUS,SHOW - SLAVE STATUS和SHOW BINARY LOGS语句。将此特权授予从属服务器用于将其作为主服务器连接到当前服务器的帐户 REPLICATION SLAVE 启用该帐户已作出对数据库的主服务器上,使用请求更新 SHOW SLAVE HOSTS, SHOW RELAYLOG EVENTS 和 SHOW BINLOG EVENTS 语句 LOCK TABLES 允许使用显式LOCK TABLES语句来锁定您具有SELECT特权的表。这包括使用写锁,这可以防止其他会话读取锁定的表 SELECT 允许使用查询语句 TRIGGER 启用触发器功能,具有此的特权才能为该表创建,删除,执行或显示触发器 UPDATE 允许修改表中记录 USAGE 无特权