Usage of Aes_encrypt, aes_dncrypt and convert in MySQL

Source: Internet
Author: User

These two days in the company's service-side project, found MySQL more practical 3 functions, here to share.

1, Aes_encrypt function, the use of this function is to some of the high security requirements of the data using AES encryption, the syntax is:

Aes_encrypt (Str,key), where the first parameter represents the data to encrypt, and the second parameter is the corresponding key.

2, Aes_decrypt function, this function is a function corresponding to the aes_decrypt, used to decrypt aes_dncrypt encrypted data, the syntax is: Aes_dncrypt (Str,key).

3, the CONVERT function, this function is generally used to convert data into another encoding format, the syntax is:

Convert (str using charset), where Str is the data to be converted, using is the keyword, and charset represents the encoding to convert to which encoding format.

Here is a demo:

The demo table has a id,name of two fields

 insert  into  demo values  (1 , Aes_encrpt (   ADGCD   ", "  ddddd    select  id,aes_decrypt (name, DDDDD  ) as  name from   demo;  select  id,convert  (name using UTF8) from  demo; 

Turn from:

http://wen147258.iteye.com/blog/2102030

Usage of Aes_encrypt, Aes_dncrypt, and convert in MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.