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