MySQL Encryption and decryption case

Source: Internet
Author: User

1Define ("ENCRYPT",'2998a15c0cd853edad7');// Key Key2  3  4 field of the stored database is set to BLOB format (binary)5  //Aes_encrypt Encryption6 Insert  into' Ks_user ' (user_name, user_pwd)Values('kstest', Aes_encrypt ('aa123456','2998a15c0cd853edad7'));7  8  //Aes_decrypt Decryption9  SelectIduser_name, Aes_decrypt (User_pwd,'2998a15c0cd853edad7') asUser_pwd from' Ks_user ';Ten +----+-----------+----------+ One |Id| user_name |User_pwd| A +----+-----------+----------+ - |  8 |Kstest|aa123456| - |  7 |Hanks|aa123456| the +----+-----------+----------+ - 2Rowsinch Set(0.16sec) -  - Select *  from' Ks_user ';//The raw data is stored in a binary + +----+-----------+------------------+ - |Id| user_name |User_pwd| + +----+-----------+------------------+ A |  8 |Kstest|f? Heaven?5? f at |  7 |Hanks|f? Heaven?5? f - +----+-----------+------------------+ - 2Rowsinch Set(0.15Sec

MySQL Encryption and decryption case

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.