在工作中,可能会接触到很多的环境问题,对于权限问题,总是感觉心有余力而力不足,环境太多了,可能在赋予权限的时候会出差错,
在工作中,可能会接触到很多的环境问题,对于权限问题,总是感觉心有余力而力不足,环境太多了,可能在赋予权限的时候会出差错, 比如下面的场景,数据都存储在owner schema上,如果要访问这些数据,需要创建一些连接用户,所有的操作不能直接在owner schema下进行。
像下面的图形,我们可以根据访问的权限定义两个角色,通过角色来统一给赋予权限。比如TESTO_ALL可以赋予select,insert,delete,update的权限,而TESTL_SEL只能赋予SELECT的权限,这样在复杂的环境中就可以基本合理的控制权限。
这是我们需要努力的方向,使得权限管理更加清晰,但是使用的过程中总是会遇到一些问题,比如有些表重建之后,权限就会丢失,如果操作不规范,就可能导致一些权限丢掉,或者赋予了过多的权限。比如给只读用户赋予了delete权限,给需要做DML的用户只赋予了select权限,没有update权限。这些都会在使用中造成一些问题。
最近客户需要在环境中添加几个只读用户,但是在分配权限的时候,可能老是会丢掉一些权限,有时候涉及的表有上千个,由于连接用户有不少,在连接用户中创建完同义词,一个一个去验证也确实很费力,也不现实。因为环境已经被很多人动过了,可能有些权限本来就有问题,有些权限又丢失,开始的时候修复基本都是根据开发的反馈进行的。
不过这样确实比较被动,专门写了下面的脚本,专门来分析哪些权限丢失了,哪些权限是不应该赋予的。
假设表为owner schema为testo,表为test1,testo_sel应该只赋予select权限,如果赋予了delete,insert,update权限就不应该了。
检查是否有遗漏的select权限 --testo_sel
select t2.grantee,t1.owner,t1.table_name ,t2.privilege missing_role_privs from all_tables t1,dba_tab_privs t2 where t2.grantee =(select role from dba_roles where role='TESTO_SEL') and t2.privilege='SELECT' and t1.owner='TESTO' and t1.table_name=t2.table_name
检查是否有额外的权限 --testo_sel,排除Insert,delete,update权限
select t2.grantee,t1.owner,t1.table_name ,t2.privilege no_need_privs from all_tables t1,dba_tab_privs t2 where t1.owner='TESTO' and t1.table_name=t2.table_name and t2.grantee=(select role from dba_roles where role='TESTO_SEL') and t2.privilege in ('DELETE','INSERT','UPDATE')
对于testo_all的权限规则相对简单,只需要判断哪些权限应该赋予,但是却没有。思路简单,做起来稍微得绕个弯子。
从数据行中判断哪些数据行不全,,最后只得使用了with子句。
检查是否有遗漏的select,delete,update,insert权限
with TEMP_DML AS
(
select 'INSERT' temp_dml from dual
union all
select 'DELETE' temp_dml from dual
union all
select 'SELECT' temp_dml from dual
union all
select 'UPDATE' temp_dml from dual
)
select 'TESTO_ALL' grantee,t1.owner,t1.table_name ,TEMP_DML.temp_dml missing_role_privs from all_tables t1,TEMP_DML where t1.owner='TESTO'
minus
select t2.grantee,t1.owner,t1.table_name ,t2.privilege missing_role_privs from all_tables t1,dba_tab_privs t2 where t2.grantee =(select role from dba_roles where role='TESTO_ALL') and t2.privilege in('SELECT','DELETE','UPDATE','INSERT') and t1.owner='TESTO' and t1.table_name=t2.table_name
本文永久更新链接地址:

mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

通過PHP網頁界面添加MySQL用戶可以使用MySQLi擴展。步驟如下:1.連接MySQL數據庫,使用MySQLi擴展。 2.創建用戶,使用CREATEUSER語句,並使用PASSWORD()函數加密密碼。 3.防止SQL注入,使用mysqli_real_escape_string()函數處理用戶輸入。 4.為新用戶分配權限,使用GRANT語句。

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。