2010-11-11 144 views

回答

2

YES

作爲替代格蘭特,你可以 直接 創建相同的帳戶發出的INSERT語句,然後 告訴服務器裝載授權 表:

shell> mysql --user=root mysql 
mysql> INSERT INTO user 
    ->  VALUES('localhost','monty',PASSWORD('some_pass'), 
    ->  'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); 
mysql> INSERT INTO user 
    ->  VALUES('%','monty',PASSWORD('some_pass'), 
    ->  'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); 
mysql> INSERT INTO user SET Host='localhost',User='admin', 
    ->  Reload_priv='Y', Process_priv='Y'; 
mysql> INSERT INTO user (Host,User,Password) 
    ->  VALUES('localhost','dummy',''); 
mysql> FLUSH PRIVILEGES; 
5

MySQL本身沒有角色。您可以創建基本的SELECT權限這樣一個新的用戶:

CREATE USER 'user'@'host' IDENTIFIED BY 'password'; 

GRANT SELECT ON database.* TO 'user'@'host'; 

FLUSH PRIVILEGES; 

MySQL授權文檔: http://dev.mysql.com/doc/refman/5.1/en/grant.html