MySQL用戶權限簡單例子:
mysql> grant all privileges on *.* to 'root'@'localhost' ;
給root用戶授予localhost機器上的所有數據庫的所有權限。
mysql> grant usage on *.* to 'user'@'localhost';
給user用戶授予localhost機器上的所有數據庫的使用權限。
mysql> grant select,insert,update,delete,create,drop on aa.* to 'user'@'localhost' identified by 'bb';
給user用戶授予localhost機器上的aa數據庫 select,insert,update,delete,create,drop 的權限,密碼爲bb。