Name

AES_DECRYPT( )

Synopsis

AES_DECRYPT(string, password)

This function decrypts text that was encrypted using the AES algorithm with a 128-bit key length, and it returns NULL if one of the given parameters is NULL. This function reverses the AES_ENCRYPT() function. This function is available as of Version 4.0.2 of MySQL.

SELECT AES_DECRYPT(personal, 'my_password') AS Personal
   FROM teachers
   WHERE teacher_id='730522';
+----------+
| Personal |
+----------+
| text     |
+----------+

In this example, the value for the personal column is decrypted using the password given. The result is just the plain text.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.