创建两个相同的用户名,不同的host,不同的密码
create user dba_test@’%’ identified by ‘123456’;
GRANT SELECT,INSERT,UPDATE,DELETE ON test.* TO ‘dba_test’@’%’;
create user dba_test@‘192.168.%’ identified by ‘654321’;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON test.* TO ‘dba_test’@‘192.168.%’;
在 192.168.X 服务器上登录并进行删除操作
mysql -udba_test -p654321 -h192.168.13.15 -P4000
MySQL [(none)]> use test;
Database changed
MySQL [test]> DROP TABLE IF EXISTS a;
ERROR 1142 (42000): DROP command denied to user ‘dba_test’@‘192.168.%’ for table ‘a’