0

Is there any way (native MySQL functions or SQL syntax) to encrypt the columns of a table in MySQL database?

2
  • You mean to values of the records for specific columns? Sep 14, 2011 at 13:55
  • Yes I mean only for the values for a specific column
    – NEO
    Sep 15, 2011 at 12:15

2 Answers 2

4

MySQL has a wide range of built-in encryption functions, you can find a detailled overview here: http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html

You might want to have a look at e.g. AES_DECRYPT() and AES_ENCRYPT().

INSERT INTO table (mycolumn) VALUES(AES_ENCRYPT('Hello!', 'encryption_key'));
SELECT AES_DECRYPT(mycolumn, 'encryption_key') FROM table;
0
1

For encryption functions you can look at: encryption-functions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.