您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“mysql中如何使用正則不允許對整表進行操作”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“mysql中如何使用正則不允許對整表進行操作”這篇文章吧。
-- 禁止應用查看表結構
delete from mysql_query_rules where rule_id=10006;
INSERT INTO mysql_query_rules (rule_id, active,username,schemaname, match_pattern, error_msg,destination_hostgroup, apply)
VALUES (10006,1,'yrzif_test2','yrzif_test2','^desc\s*\S*','desc is not allowed',2,1);
LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
-- 禁止應用對information_schema進行查詢
delete from mysql_query_rules where rule_id=10007;
INSERT INTO mysql_query_rules (rule_id, active,username,schemaname, match_pattern, error_msg,destination_hostgroup, apply)
VALUES (10007,1,'yrzif_test2','yrzif_test2','\s*\S*information_schema\s*\S*','query on information_schema is not allowed',2,1);
LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
-- 禁止對整表進行不加條件的查詢
delete from mysql_query_rules where rule_id=10001;
INSERT INTO mysql_query_rules (rule_id, active,username,schemaname, match_pattern, error_msg,destination_hostgroup, apply)
VALUES (10001,1,'yrzif_test2','yrzif_test2','^SELECT\s*\*\s*from\s*fi_user_bak$','Query not allowed',2,1);
LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
-- 禁止對整表進行不加條件的刪除
delete from mysql_query_rules where rule_id=1002;
INSERT INTO mysql_query_rules (rule_id, active, username,schemaname,match_pattern, error_msg, apply) VALUES (1002,1,'yrzif_test2','yrzif_test2','^DELETE\s*from\s*fi_user_bak$','Query not allowed',1);
LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
-- 禁止對整表進行不加條件的更新
delete from mysql_query_rules where rule_id=1003;
delete from mysql_query_rules where rule_id=1004;
delete from mysql_query_rules where rule_id=1005;
INSERT INTO mysql_query_rules (rule_id, active,username,schemaname, match_digest, flagOUT, apply) VALUES (1003,1,'yrzif_test2','yrzif_test2','^update\s*fi_user_bak', 100, 0);
INSERT INTO mysql_query_rules (rule_id, active,username,schemaname, flagIN, match_digest, destination_hostgroup, apply) VALUES (1004,1,'yrzif_test2','yrzif_test2', 100, 'WHERE', 9, 1);
INSERT INTO mysql_query_rules (rule_id, active,username,schemaname, flagIN, error_msg, apply) VALUES (1005,1, 'yrzif_test2','yrzif_test2',100, 'Query not allowed', 1);
LOAD MYSQL QUERY RULES TO RUNTIME;SAVE MYSQL QUERY RULES TO DISK;
以上是“mysql中如何使用正則不允許對整表進行操作”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。