当前位置:网站首页>MySQL存储数据加密
MySQL存储数据加密
2022-07-04 21:37:00 【CodingSir】
加密方式主流的有两种
ENCODE 与 DECODE
# 建一张测试表
create table users(
username varchar(128), # 用户昵称
password blob #密码
) engine=innodb default charset=utf8;
# 插入一条测试语句
INSERT INTO users (username, password) VALUES ('john', ENCODE('guessme', 'salt'));
commit;
# 查询john的密码(用的mysql workbench)
select t.username, DECODE(t.password,'salt') as password from users t where t.username = 'john';
# 在查询结构的password值上,右键,'open value in viewer'。可以看到text TAB下的密码明文。
AES_ENCRYPT 与 AES_DECRYPT
这个加密方式的安全级别比encode高,在新版本的数据库中已经弃用encode与decode。
# 测试表,同样使用users
# 插入一条语句
INSERT INTO users (username, password) VALUES ('steven', aes_encrypt('password', 'salt'));
commit;
# 查询steven的密码(用的mysql workbench)
select t.username, aes_decrypt(t.password,'salt') as password from users t where t.username = 'steven';
边栏推荐
猜你喜欢

Three or two things about the actual combat of OMS system
![Compréhension approfondie du symbole [langue C]](/img/4b/26cf10baa29eeff08101dcbbb673a2.png)
Compréhension approfondie du symbole [langue C]

CloudCompare&Open3D DBSCAN聚类(非插件式)

El tree combined with El table, tree adding and modifying operations
![[public class preview]: basis and practice of video quality evaluation](/img/fd/42b98a08b5a0fd89c119f1d1a8fe1b.png)
[public class preview]: basis and practice of video quality evaluation

QT—绘制其他问题

复数在数论、几何中的用途 - 曹则贤

Application practice | Shuhai supply chain construction of data center based on Apache Doris
![[optimtool.unconstrained] unconstrained optimization toolbox](/img/ef/65379499df205c068ee9bc9df797ac.png)
[optimtool.unconstrained] unconstrained optimization toolbox

迷失在Mysql的锁世界
随机推荐
Is it safe to open an account in the stock of Caicai college? Can you only open an account by digging money?
可视化任务编排&拖拉拽 | Scaleph 基于 Apache SeaTunnel的数据集成
new IntersectionObserver 使用笔记
Sorting and sharing of selected papers, systems and applications related to the most comprehensive mixed expert (MOE) model in history
How was MP3 born?
迷失在Mysql的锁世界
Hash table
283. 移动零-c与语言辅助数组法
Master the use of auto analyze in data warehouse
Cadeus has never stopped innovating. Decentralized edge rendering technology makes the metauniverse no longer far away
Super detailed tutorial, an introduction to istio Architecture Principle and practical application
Redis 排查大 key 的3种方法,优化必备
淘宝商品评价api接口(item_review-获得淘宝商品评论API接口),天猫商品评论API接口
# 2156. Find the substring of the given hash value - post order traversal
开户哪家券商比较好?网上开户安全吗
Enlightenment of maker thinking in Higher Education
【LeetCode】17、电话号码的字母组合
CloudCompare&Open3D DBSCAN聚类(非插件式)
使用 BlocConsumer 同时构建响应式组件和监听状态
Exclusive interview of open source summer | new committer Xie Qijun of Apache iotdb community