1. grant 作用在整個 MySQL 服務器上:
grant select on *.* to dba@localhost; -- dba 可以查詢 MySQL 中所有數據庫中的表。
grant all on *.* to dba@localhost; -- dba 可以管理 MySQL 中的所有數據庫
2. grant 作用在單個數據庫上:
grant select on testdb.* to dba@localhost; -- dba 可以查詢 testdb 中的表。
3. grant 作用在單個數據表上:
grant select, insert, update, delete on testdb.orders to
4. grant 作用在表中的列上:
grant select(id, se, rank) on testdb.apache_log to
5.MySQL grant 作用在存儲過程、函數上:
grant execute on procedure testdb.pr_add to 'dba'@'localhost' ?
grant execute on function testdb.fn_add to 'dba'@'localhost'?