以123.123.123.123 、123.123.123.124两个IP地址的用户访问db1为例,分别创建用户名user1、user2
1、为123.123.123.123上创建用户user1
create user ‘user1’@’123.123.123.123’ IDENTIFIED BY ‘XXXXXXX’;
grant select on db1.table1 to ‘user1’@’123.123.123.123’ ;
2、为123.123.123.124上创建用户user2
create user ‘user2’@’123.123.123.124’ IDENTIFIED BY ‘YYYYY’;
grant select on db1.table1 to ‘user2’@’123.123.123.124’ ;
说明:用户是按IP区分的,不同IP用户名可以相同