当前位置:网站首页>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';
边栏推荐
猜你喜欢

Enlightenment of maker thinking in Higher Education

VS2019 C# release下断点调试

如何借助自动化工具落地DevOps

案例分享|金融业数据运营运维一体化建设

Keep on fighting! The city chain technology digital summit was grandly held in Chongqing

Redis 排查大 key 的3种方法,优化必备

HUAWEI nova 10系列发布 华为应用市场筑牢应用安全防火墙

Application practice | Shuhai supply chain construction of data center based on Apache Doris

How was MP3 born?

Lambdaquerywrapper usage
随机推荐
Master the use of auto analyze in data warehouse
WebGIS框架---kalrry
283. 移动零-c与语言辅助数组法
el-tree结合el-table,树形添加修改操作
Golang面试整理 三 简历如何书写
QT—绘制其他问题
GTEST from ignorance to proficiency (3) what are test suite and test case
服装企业为什么要谈信息化?
Enlightenment of maker thinking in Higher Education
复数在数论、几何中的用途 - 曹则贤
历史最全混合专家(MOE)模型相关精选论文、系统、应用整理分享
Rotary transformer string judgment
机器学习笔记 - 互信息Mutual Information
Bookmark
Flutter 返回按钮的监听
Telephone encryption, middle 4 is replaced by * * * *
What is the stock account opening process? Is it safe to use flush mobile stock trading software?
Hash table
Why do you have to be familiar with industry and enterprise business when doing Bi development?
# 2156. 查找给定哈希值的子串-后序遍历