MYSQL encrypted SQL

Source: Internet
Author: User
Tags enpass
INSERTINTOtable1 (user, pw) VALUE (user1, MD5 (password1) INSERTINTOtable1 (user, pw) VALUE (user1, PASSWORD (password1) INSERTINTOtable1 (user, pw) VALUE (user1, SHA1 (password1) can use the following statement for password verification: SELE

Insert into table1 (user, pw) VALUE ('user1', MD5 ('password1 ') insert into table1 (user, pw) VALUE ('user1 ', PASSWORD ('password1 ') insert into table1 (user, pw) VALUE ('user1', SHA1 ('password1') can be verified using the following statement: SELE


Insert into table1 (user, pw) VALUE ('user1', MD5 ('password1 '))

Insert into table1 (user, pw) VALUE ('user1', PASSWORD ('password1 '))

Insert into table1 (user, pw) VALUE ('user1', SHA1 ('password1 '))


You can use the following statement to verify the password:

SELECT * FROM table1 WHERE pw = MD5 ('password1 ')

SELECT * FROM test. userpass WHERE pass = SHA1 ('ddddd ')

SELECT * FROM test. userpass WHERE pass = password ('ddddd ')





















Insert into test. userpass (name, pass, enpass) VALUE ('user3', 'ddddd', AES_ENCRYPT ('pass', 'key '));

The preceding insert statement has three fields: "User Name", "password", and "encrypted password ". The AES_ENCRYPT () function requires a "key" to assist in encryption. Similarly, it is also required for decryption.

SELECT aes_decrypt (enpass, 'key') FROM test. userpass



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.