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)
mysql> show grants for user2@192.168.15.132;
+-------------------------------------------------------------------------------------------------------------------+
| Grants for user2@192.168.15.132 |
+-------------------------------------------------------------------------------------------------------------------+
| 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)
13.4 mysql用户管理 13.5 常用sql语句 13.6 mysql数据库备份恢复
原文地址:http://blog.51cto.com/12058686/2090745