Wednesday, January 13, 2010

encrypt and decrypt in mysql

First you need to create the fields and that fields must be varbinary or blob type and length also must be at least 128 characters long.

 aes_encrypt(VALUE,'mykey')
 aes_decrypt(COLUMN NAME, 'mykey')


INSERT INTO userinfo(add1) VALUES (aes_encrypt('my address','mykey'))
SELECT aes_decrypt(add1, 'mykey') FROM userinfo

No comments:

Post a Comment