当前位置:网站首页>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';
边栏推荐
- Bookmark
- Redis has three methods for checking big keys, which are necessary for optimization
- Compréhension approfondie du symbole [langue C]
- B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条
- 机器学习笔记 - 互信息Mutual Information
- [public class preview]: basis and practice of video quality evaluation
- EhLib 数据库记录的下拉选择
- GTEST from ignorance to proficient use (2) what is test fixture
- gtest从一无所知到熟练使用(4)如何用gtest写单元测试
- ACM Multimedia 2022 | 视觉语言预训练模型中社会偏见的反事实衡量和消除
猜你喜欢
【LeetCode】17、电话号码的字母组合
Redis03 - network configuration and heartbeat mechanism of redis
[optimtool.unconstrained] unconstrained optimization toolbox
How was MP3 born?
TCP三次握手,四次挥手,你真的了解吗?
B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条
TCP协议三次握手过程
[leetcode] 17. Letter combination of telephone number
How to remove the black dot in front of the title in word document
Three or two things about the actual combat of OMS system
随机推荐
VS2019 C# release下断点调试
类方法和类变量的使用
Open3D 曲面法向量计算
How was MP3 born?
Redis 排查大 key 的3种方法,优化必备
ArcGIS 10.2.2 | solution to the failure of ArcGIS license server to start
[leetcode] 17. Letter combination of telephone number
Rotary transformer string judgment
Flink1.13 SQL basic syntax (I) DDL, DML
PostgreSQL基本结构——表
El tree combined with El table, tree adding and modifying operations
电话加密,中间4为****代替
Shutter textfield example
DevEco Device Tool 3.0 Release带来5大能力升级,让智能设备开发更高效
Go语言循环语句(第10课中3)
删库不必跑路!详解 MySQL 数据恢复
QT—绘制其他问题
赋能数字经济 福昕软件出席金砖国家可持续发展高层论坛
MongoDB聚合操作总结
New intersectionobserver usage notes