MySQL帳號權限

mysql權限分爲全局權限、庫權限、表權限,對應於mysql庫裏面的user表、db表、tables_priv表。mysql

grant all privileges on *.*  :操做mysql.user表
sql

grant all privileges on db.*  :操做mysql.db表ide

grant all privileges on db.table :操做mysql.tables_priv表spa

這三種操做分別對應不一樣的表,互不影響,賦予一個用戶大粒度的權限,並不能收回小粒度的權限。it

示例以下:table


root@localhost:mysql3306.sock  14:02:  [test]>grant all privileges on *.* to test@'127.0.0.1';   class

Query OK, 0 rows affected (0.00 sec)test

root@localhost:mysql3306.sock  14:03:  [test]>revoke update on test.* from  test@'127.0.0.1';      date

ERROR 1141 (42000): There is no such grant defined for user 'test' on host '127.0.0.1'權限

root@localhost:mysql3306.sock  14:03:  [test]>revoke update on test.a from  test@'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'

相關文章
相關標籤/搜索