Home > Database > Mysql Tutorial > How MySQL uses encryption functions

How MySQL uses encryption functions

PHPz
Release: 2023-05-28 08:09:33
forward
1887 people have browsed it

Encryption function

Command: md5(data)

Function: used to encrypt data

Application scenarios: encryption, some private data, For example, bank card numbers, ID cards, etc. need to store ciphertext. (Of course, it is not recommended to use database layer encryption. It should be encrypted at the application layer.)

Example:

mysql> select md5("andyqian");
+----------------------------------+
| md5("andyqian")   |
+----------------------------------+
| 8a6f60827608e7f1ae29d1abcecffc3a |
+----------------------------------+
1 row in set (0.00 sec)
Copy after login

Note: If your database currently The data in is still plain text, and you can use the database encryption algorithm to encrypt it.

For example: (for demonstration only):

update t_base_user set name=md5(name),updated_time=now() where id=1;
Copy after login

Supported encryption functions are:

md5()
des_encrypt(加密) / des_decrypt(解密);
sha1()
password() 等等
Copy after login

The above is the detailed content of How MySQL uses encryption functions. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template