溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

mysql中如何使用正則不允許對(duì)整表進(jìn)行操作

發(fā)布時(shí)間:2021-11-03 10:02:20 來源:億速云 閱讀:114 作者:小新 欄目:MySQL數(shù)據(jù)庫

這篇文章主要為大家展示了“mysql中如何使用正則不允許對(duì)整表進(jìn)行操作”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“mysql中如何使用正則不允許對(duì)整表進(jìn)行操作”這篇文章吧。

-- 禁止應(yīng)用查看表結(jié)構(gòu)
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;




-- 禁止應(yīng)用對(duì)information_schema進(jìn)行查詢
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;




-- 禁止對(duì)整表進(jìn)行不加條件的查詢
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;




-- 禁止對(duì)整表進(jìn)行不加條件的刪除
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;




-- 禁止對(duì)整表進(jìn)行不加條件的更新
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中如何使用正則不允許對(duì)整表進(jìn)行操作”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI