同一个账号创建多个密码或者不同权限,精确匹配优先

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)

猜你喜欢

转载自www.cnblogs.com/liang545621/p/9400345.html