w3resource
MYSQL Tutorial

MySQL MD5() function

MD5() function

MySQL MD5() Calculates an MD5 128-bit checksum for a string. The value is returned as a binary string of 32 hex digits, or NULL if the argument was NULL. The return value can, for example, be used as a hash key.

Syntax:

MD5(str);

Argument

Name Description
str A string whose MD5 value is to be calculated.

Syntax Diagram:

MySQL MD5() Function - Syntax Diagram

MySQL Version: 5.6


Example:

Code:

SELECT MD5('w3resource'); 

Explanation

The above MySQL statement returns MD5 value of w3resource. The return value is b273cb2263eb88f61f7133cd308b4064.

Sample Output:

mysql> SELECT MD5('w3resource'); 
+----------------------------------+
| MD5('w3resource')                |
+----------------------------------+
| b273cb2263eb88f61f7133cd308b4064 | 
+----------------------------------+
1 row in set (0.04 sec)

Previous: ENCRYPT()
Next: OLD_PASSWORD()