MySQL企業(yè)版里面的數(shù)據(jù)屏蔽的功能,在Percona 8.0.17里面被開源實現(xiàn)了。
創(chuàng)新互聯(lián)于2013年創(chuàng)立,先為商南等服務建站,商南等地企業(yè),進行企業(yè)商務咨詢服務。為商南企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。
具體可以參考下面3篇文檔:?
https://dev.mysql.com/doc/mysql-security-excerpt/8.0/en/data-masking-installation.html
https://www.percona.com/doc/percona-server/LATEST/security/data-masking.html、
https://www.percona.com/blog/2020/01/06/data-masking-in-percona-server-for-mysql-to-protect-sensitive-data/
我們這里演示方便起見,用dbdeployer來部署:
dbdeployer?unpack?--prefix=ps?Percona-Server-8.0.18-9-Linux.x86_64.ssl101.tar.gz dbdeployer?deploy?single?ps8.0.18?--bind-address='0.0.0.0'?--gtid?--init-general-log?--enable-genera-log?--disable-mysqlx?--force
?
cd /sandboxes/msb_ps8_0_18/
cat my.sandbox.cnf? 修改下 client段的user為root(默認dbdeployer部署的是低權(quán)限賬號)
[client] user?=?root
# 安裝data_masking?插件
./use??登錄進mysql控制臺 mysql?[localhost:8018]?{root}?(test)?>?INSTALL?PLUGIN?data_masking?SONAME?'data_masking.so'; Query?OK,?0?rows?affected?(0.02?sec)
# 演示數(shù)據(jù)屏障功能
mysql?[localhost:8018]?{root}?(test)?>?SELECT?mask_outer('This?is?a?string',?5,?1);???#?前5個和最后1個字符,用掩碼替代 +--------------------------------------+ |?mask_outer('This?is?a?string',?5,?1)?| +--------------------------------------+ |?XXXXXis?a?strinX?????????| +--------------------------------------+ 1?row?in?set?(0.00?sec) mysql?[localhost:8018]?{root}?(test)?>?SELECT?mask_pan_relaxed(gen_rnd_pan());? +---------------------------------+ |?mask_pan_relaxed(gen_rnd_pan())?| +---------------------------------+ |?545151XXXXXX1753???????| +---------------------------------+ 1?row?in?set?(0.00?sec)
具體還有很多,參考上面的3個連接即可。。