当前位置:网站首页>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';
边栏推荐
- gtest从一无所知到熟练使用(4)如何用gtest写单元测试
- 文件读取写入
- [optimtool.unconstrained] unconstrained optimization toolbox
- [C language] deep understanding of symbols
- 如何借助自动化工具落地DevOps
- new IntersectionObserver 使用笔记
- Enlightenment of maker thinking in Higher Education
- 开户哪家券商比较好?网上开户安全吗
- Drop down selection of Ehlib database records
- Telephone encryption, middle 4 is replaced by * * * *
猜你喜欢

ArcGIS 10.2.2 | solution to the failure of ArcGIS license server to start
![[advanced C language] array & pointer & array written test questions](/img/3f/83801afba153cfc0dd73aa8187ef20.png)
[advanced C language] array & pointer & array written test questions

QT - plot other problems

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

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

TCP三次握手,四次挥手,你真的了解吗?

什么是商业智能(BI),就看这篇文章足够了

Case sharing | integrated construction of data operation and maintenance in the financial industry
![[weekly translation go] how to code in go series articles are online!!](/img/bf/77253c87bfa1512f4b8d3d8f7ebe80.png)
[weekly translation go] how to code in go series articles are online!!

Operation of adding material schedule in SolidWorks drawing
随机推荐
Cadeus has never stopped innovating. Decentralized edge rendering technology makes the metauniverse no longer far away
Open3d surface normal vector calculation
【LeetCode】17、电话号码的字母组合
Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe to open an account online
面试官:说说XSS攻击是什么?
WebGIS框架---kalrry
电话加密,中间4为****代替
Spatiotemporal prediction 3-graph transformer
Go语言循环语句(第10课中3)
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
What is the stock account opening process? Is it safe to use flush mobile stock trading software?
一文掌握数仓中auto analyze的使用
Application practice | Shuhai supply chain construction of data center based on Apache Doris
1807. 替换字符串中的括号内容
超详细教程,一文入门Istio架构原理及实战应用
Interpreting the development of various intelligent organizations in maker Education
EhLib 数据库记录的下拉选择
GTEST from ignorance to proficiency (4) how to write unit tests with GTEST
Analysis of maker education technology in the Internet Era
How to implement Devops with automatic tools