13.4 mysql用戶管理
-
grant all on . to 'user1' identified by 'passwd';
mysql> grant all on . to 'user1' identified by 'passwd';
Query OK, 0 rows affected (0.01 sec) -
grant SELECT,UPDATE,INSERT on db1. to 'user2'@'192.168.15.132' identified by 'passwd';
mysql> mysql> grant SELECT,UPDATE,INSERT on db1. to 'user2'@'192.168.15.132' identtified by 'passwd';
Query OK, 0 rows affected (0.03 sec) -
grant all on db1. to 'user3'@'%' identified by 'passwd';
mysql> grant all on db1. to 'user3'@'%' identified by 'passwd';
Query OK, 0 rows affected (0.01 sec) -
show grants;
mysql> show grants\G;
1. row
Grants for root@localhost: GRANT ALL PRIVILEGES ON . TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*617636C103DE2F02681E9CB9DD2418DD4000DF30' WITH GRANT OPTION
2. row
Grants for root@localhost: GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
2 rows in set (0.01 sec) - show grants for [email protected]
mysql> show grants for [email protected];
+-------------------------------------------------------------------------------------------------------------------+
| Grants for [email protected] |
+-------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO 'user2'@'192.168.15.132' IDENTIFIED BY PASSWORD '59C70DA2F3E3A5BDF46B68F5C8B8F25762BCCEF0' |
| GRANT SELECT, INSERT, UPDATE ONdb1
. TO 'user2'@'192.168.15.132' |
+-------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)