SQL Tutorial SQL Advanced SQL Database SQL References

MySQL MD5() Function



The MySQL MD5() function returns an MD5 128-bit checksum representation of a given string. This function returns a 32 character hex string as the result. The result from this function can be used as a hash key.

The MD5() function returns NULL if the string is NULL.

Syntax

MD5(string)

Parameters

string Required. Specify the plaintext string used to generate the MD5 128-bit checksum.

Return Value

Returns the MD5 128-bit checksum representation of a string.

Example:

The example below shows the usage of MD5() function.

mysql> SELECT MD5('xyz');
Result: 'd16fb36f0911f878998c136191af705e'

mysql> SELECT MD5('password');
Result: '5f4dcc3b5aa765d61d8327deb882cf99'

mysql> SELECT MD5('alphacodingskills');
Result: 'de0e02d2e002982195993556f112635c'

mysql> SELECT MD5(123);
Result: '202cb962ac59075b964b07152d234b70'

mysql> SELECT MD5(NULL);
Result: NULL

❮ MySQL Functions