The value is returned as a string of 32 hexadecimal digits, or
NULLif the argument was
The return value is a string in the connection character set.
mysql> SELECT MD5('Hello world!');
The above example will output:
Example #2 with salt before string to be encrypted:
In some cases, it is worth using a salted MD5 hash for added security. This means that you add the "salt string" before or after the string to be encrypted.
mysql> SELECT MD5(CONCAT('yourSalt', 'Hello world!'));OR
mysql> SELECT MD5('yourSalt' 'Hello world!');
Example #2 will output:
Note: Be aware that using encryption functions in a database usually means that the original, unencrypted text will be stored in the database log, which in some cases can be a potential security risk.