grant 指令格式如下:
GRANT priv_type [(column_list)] [, priv_type [(column_list)] ...]
ON {tbl_name | * | *.* | db_name.*}
TO user_name [IDENTIFIED BY 'password']
[, user_name [IDENTIFIED BY 'password'] ...]
[WITH GRANT OPTION]
範例
grant all privileges on DB.* to user@localhost identified by 'xxx';
all privileges 表示開放所有權限,也可限定只能讀或其他權限。
ALL PRIVILEGES FILE RELOAD
ALTER INDEX SELECT
CREATE INSERT SHUTDOWN
DELETE PROCESS UPDATE
DROP REFERENCES USAGE
DB.* 表示這樣的權限設定針對 DB 這個資料庫下的所有 table.
user@localhost 即管理者帳號
xxx 就是密碼了。
沒有留言:
張貼留言