Query Rewrite Plugins
[root@ZST1 ~] mysql --login-path=3306 </usr/local/mysql/share/install_rewriter.sql mydba@192.168.85.132,3306 [(none)]> create database qrp_drop; Query OK, 1 row affected (0.00 sec) mydba@192.168.85.132,3306 [(none)]> insert into query_rewrite.rewrite_rules(pattern,pattern_database,replacement) -> values('select 3','qrp_drop','drop database qrp_drop'); Query OK, 1 row affected (0.01 sec) mydba@192.168.85.132,3306 [(none)]> call query_rewrite.flush_rewrite_rules; Query OK, 0 rows affected (0.01 sec) mydba@192.168.85.132,3306 [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | qrp_drop | | query_rewrite | | replcrash | | sbtest | | sys | +--------------------+ 8 rows in set (0.00 sec) mydba@192.168.85.132,3306 [(none)]> select 3; Query OK, 0 rows affected, 1 warning (0.00 sec) mydba@192.168.85.132,3306 [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | query_rewrite | | replcrash | | sbtest | | sys | +--------------------+ 7 rows in set (0.00 sec) mydba@192.168.85.132,3306 [(none)]>
因为不懂,所以加倍努力!