当前位置:网站首页>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';
边栏推荐
- close系统调用分析-性能优化
- PMO:比较25种分子优化方法的样本效率
- WebGIS框架---kalrry
- 哈希表(Hash Tabel)
- gtest从一无所知到熟练使用(2)什么是测试夹具/装置(test fixture)
- Keep on fighting! The city chain technology digital summit was grandly held in Chongqing
- Analyzing the maker space contained in steam Education
- How much is the minimum stock account opening commission? Is it safe to open an account online
- 案例分享|金融业数据运营运维一体化建设
- PostgreSQL基本结构——表
猜你喜欢
Super detailed tutorial, an introduction to istio Architecture Principle and practical application
[C language] deep understanding of symbols
使用 BlocConsumer 同时构建响应式组件和监听状态
保证接口数据安全的10种方案
CloudCompare&Open3D DBSCAN聚类(非插件式)
Analysis of maker education technology in the Internet Era
Redis03 - network configuration and heartbeat mechanism of redis
Redis 排查大 key 的3种方法,优化必备
[public class preview]: basis and practice of video quality evaluation
NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
随机推荐
How to implement Devops with automatic tools
复数在数论、几何中的用途 - 曹则贤
MongoDB中的索引操作总结
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Cadre WebGIS - kalrry
Flutter TextField示例
关系型数据库
机器学习笔记 - 互信息Mutual Information
WebGIS框架---kalrry
Use of class methods and class variables
TCP shakes hands three times and waves four times. Do you really understand?
【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】
Bookmark
服务线上治理
Golang面试整理 三 简历如何书写
Hash table
超详细教程,一文入门Istio架构原理及实战应用
开户哪家券商比较好?网上开户安全吗
Drop down selection of Ehlib database records
HUAWEI nova 10系列发布 华为应用市场筑牢应用安全防火墙