5ol.cc 发表于 2018-10-10 09:46:21

MySQL账号权限

  mysql权限分为全局权限、库权限、表权限,对应于mysql库里面的user表、db表、tables_priv表。
  grant all privileges on *.*:操作mysql.user表
  grant all privileges on db.*:操作mysql.db表
  grant all privileges on db.table :操作mysql.tables_priv表
  这三种操作分别对应不同的表,互不影响,赋予一个用户大粒度的权限,并不能收回小粒度的权限。
  示例如下:
  root@localhost:mysql3306.sock14:02:>grant all privileges on *.* to test@'127.0.0.1';
  Query OK, 0 rows affected (0.00 sec)
  root@localhost:mysql3306.sock14:03:>revoke update on test.* fromtest@'127.0.0.1';
  ERROR 1141 (42000): There is no such grant defined for user 'test' on host '127.0.0.1'
  root@localhost:mysql3306.sock14:03:>revoke update on test.a fromtest@'127.0.0.1';
  ERROR 1147 (42000): There is no such grant defined for user 'test' on host '127.0.0.1' on table 'a'

页: [1]
查看完整版本: MySQL账号权限