(1)登录mysql:[password可以为空,但是这样不安全]
  1
  mysql> grant all privileges on dbname.tbname to 'username'@'login ip' identified by 'password' with grant option;
  2
  dbname=*表示所有数据库
  3
  tbname=*表示所有表
  4
  login ip=%表示任何ip
  5
  password为空,表示不需要密码即可登录
  (2)更新:
  1
  mysql> flush privileges
  (3)用户远程登录,只能进行特定的操作:
  1
  mysql> grant select,insert,update,delete on *.* to 'root'@'ip' identified by "password";
  (4)回收权限:
  01
  mysql> revoke privileges on dbname[.tbname] from username;
  02
  privileges包括:
  03
  alter:修改数据库的表
  04
  create:创建新的数据库或表
  05
  delete:删除表数据
  06
  drop:删除数据库/表
  07
  index:创建/删除索引
  08
  insert:添加表数据
  09
  select:查询表数据
  10
  update:更新表数据
  11
  all:允许任何操作
  12
  usage:只允许登录UID: 84292mysql数据库