当前位置:网站首页>mysql数据库中的数据如何加密呢?mysql8.0自带新特性
mysql数据库中的数据如何加密呢?mysql8.0自带新特性
2022-07-27 17:20:00 【运维家】

===============================================================================================================================================================================
加密函数主要用来对数据进行加密和界面处理,以保证某些重要数据不被别人获取。
加密函数MD5(str)
md5(str)字符串算出一个md5 128比特校验和。
该值以32位十六进制数字的二进制字符串形式返回,如果参数是null,则返回的值就是null;
mysql> select md5('yunweijia'), length(md5('yunweijia'));
+----------------------------------+--------------------------+
| md5('yunweijia') | length(md5('yunweijia')) |
+----------------------------------+--------------------------+
| e1c2c47c0b1d8ca6076030bf8e8ea42a | 32 |
+----------------------------------+--------------------------+
1 row in set (0.00 sec)
mysql>
可以看到确实是返回了一个32位长度的十六进制数字的字符串。
加密函数SHA(str)
SHA(str)从原明文密码str计算并返回加密后的密码字符串,当参数为null的时候,返回的值也就是null。
SHA加密算法相对于MD5加密算法,会更加安全。
mysql> select sha('yunweijia');
+------------------------------------------+
| sha('yunweijia') |
+------------------------------------------+
| 683501978a90d76d420b893cd7e00c8efde8e8f3 |
+------------------------------------------+
1 row in set (0.00 sec)
mysql>
加密函数SHA2(str, hash_length)
SHA2(str, hash_length):使用hash_length作为长度,加密字符串str;
hash_length支持的值为:224、256、384、512和0,为什么会有0呢,如果是0的话,就相当于是256了。
mysql> select sha2('yunweijia', 256) as A, sha2('yunweijia', 0) as B\G;
*************************** 1. row ***************************
A: 1c60cca8fb0ef62bbf751245f72bbb7c308d59d773214133dc6051cd4acd0b64
B: 1c60cca8fb0ef62bbf751245f72bbb7c308d59d773214133dc6051cd4acd0b64
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
从上面的运行结果可以看到哈,当我们的hash_length的值为256和0时,他们两个的结果是一致的。
至此,本文结束。
更多内容请转至VX公众号 “运维家” ,获取最新文章。
------ “运维家” ------
------ “运维家” ------
------ “运维家” ------
linux中断异常,linuxuml建模,linux编译多个源文件,linux怎么更新时间,linux中的分页视频教程,
linux怎么解压gzip,linux解压某个目录,怎么关闭linux网关,linux文件架构图,linux提高权限执行,
linux文件用什么标志,网络安全linux加固,linux中查看邮件,linux修改背景颜色,linux环境下搭建网站。
边栏推荐
- [basic knowledge of in-depth learning - 40] Why does CNN have more advantages than DNN in the field of images
- 归一化(Normalization)和标准化(Standardization)
- ArrayAdapter(数组适配器)与SimpleAdapter(简单适配器)
- 常见运算符9.21
- ContextMenu(上下文菜单)
- Surpass Huawei? Ericsson has won more than 75 5g commercial contracts
- What's new in helix QAC 2022.2, the ace code static testing tool (1)
- DatePicker(日期选择器)与TimePicker(时间选择器)
- C193:评分系统
- Radiogroup (radio box)
猜你喜欢

GestureDetector(手势识别)

UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xff in position 0: invalid start byte

Togglebutton (button switch)

Fabric上搭建Hyperledger caliper进行性能测试

Adults have only one main job, but they have to pay a price. I was persuaded to step back by personnel, and I cried all night

Cesium常用坐标系详细介绍

JS 寻找所有节点sibling childNodes children

使用VS编译NCNN

Introduction to socke programming
![[basic knowledge of deep learning - 43] concept of odds ratio](/img/74/d7d1562ada4671864961721b9a1baf.png)
[basic knowledge of deep learning - 43] concept of odds ratio
随机推荐
注入攻击
[basic knowledge of deep learning - 49] kmeans
[basic knowledge of deep learning - 39] comparison of BN, LN and WN
SQlife(数据库)
Oppo released the first AR glasses and announced that it would invest 50billion in research and development in the next three years
探索新一代活动获客方式,虚拟化活动棋胜一招 | 厂商征集
AutoCompleteTextView (input box pre match)
File operation protection
C170:复试筛选
[basic knowledge of deep learning - 50] PCA dimensionality reduction principal component analysis
链表~~~
文件操作防护
Hacker introductory tutorial (very detailed) from zero basic introduction to proficiency, it is enough to read this one.
It is said that Apple plans to buy some JDI factories with us $200million
TSMC 5nm is about to mass produce: Apple A14 monopolizes 70% of the production capacity, and Huawei Kirin 1020 takes 30%
Datepicker and TimePicker
Use of jvisualvm
Oracle 日期的转换
Gesturedetector (gesture recognition)
Matplotlib(基本用法)