d control
of the block encryption mode. The default mode is specified by the
block_encryption_mode system variable, which can be changed when calling the
function with a mode. mode is aes-{128,192,256}-{ecb,cbc,ctr} for example:
"AES-128-cbc".

For modes that require it, the initialization_vector iv should be 16 bytes (it
can be longer, but the extra bytes are ignored). A shorter iv, where one is
required, results in the function returning NULL. Calling RANDOM_BYTES(16)
will generate a random series of bytes that can be used for the iv.

Examples
--------

From MariaDB 11.2.0:

SELECT HEX(AES_ENCRYPT('foo', 'bar', '0123456789abcdef', 'aes-128-ctr')) AS x; 
+--------+
| x      |
+--------+
| C57C4B |
+--------+

SELECT AES_DECRYPT(x'C57C4B', 'bar', '0123456789abcdef', 'aes-128-ctr'); 
+------------------------------------------------------------------+
| AES_DECRYPT(x'C57C4B', 'bar', '0123456789abcdef', 'aes-128-ctr') |
+------------------------------------------------------------------+
| foo                                                              |
+------------------------------------------------------------------+

URL: https://mariadb.com/kb/en/aes_decrypt/https://mariadb.com/kb/en/aes_decrypt/