Grant all on * * to ' user1 ' identified by ' passwd '
Grant Select,update,insert on db1.* to ' user2 ' @ ' 192.168.133.1 ' identified by ' passwd ';
Grant all on db1.* to ' user3 ' @ '% ' of ' identified by ' passwd ';
Show grants;
Show grants for [email protected];
1.grant all on * * to ' user1 ' @127.0.0.1 ' identified by ' 123456 ';
Authorized to user1 this user all permissions,
127.0.0.1, which is the source IP, means that the MySQL can only be connected via this IP
* * This * is the library name
Then quit MySQL and log in using the following command:
mysql-uuser1-p123456-h127.0.0.1 #即可登录
Can be changed to localhost, you do not need to specify an IP login, as follows:
Grant all on * * to ' user1 ' @localhost ' identified by ' 123456 '; #则登录的时候直接 mysql-uuser1-p123456 can log in directly
Grant Select,update,insert on db1.* to ' user2 ' @ ' 192.168.133.1 ' identified by ' passwd ';
Grant Select,update,insert on db1.* to ' user2 ' @ ' 192.168.133.1 ' identified by ' passwd ';
Show Grants\g;
Show grants for [email protected] ' 192.168.133.1 ';
There is a situation will be used, I give 192.168.133.1IP authorization, found not enough, but also to 192.168.133.2 on the re-authorization, you can do this:
Show grants for [email protected] ' 192.168.133.1 ';
Then copy the two sentences in the list, and note that both groups need to be duplicated because they are a group;
Then show grants for [email protected] ' 192.168.133.2; ' Then you can find one and 1 two segments.
mysql--User Management