create user 'test'@'%' identified by 'a1';
create user 'test'@'192.168.56.%' identified by 'a2';
create user 'test'@'192.168.56.156' identified by 'a3';
当同一个账号有多个密码或者不同权限时,精确匹配优先。
查看有多少账号
mysql> select user,host from mysql.user;
+-----------+----------------+
| user | host |
+-----------+----------------+
| test | % |
| test | 192.168.56.% |
| test | 192.168.56.156 |
| mysql.sys | localhost |
| root | localhost |
+-----------+----------------+
5 rows in set (0.00 sec)