MySQL: MD5 Function

  • Post author:
  • Post category:MySQL
  • Post comments:1 Comment
MySQL MD5 Function

In this guide, we will explain how to use the MySQL MD5 function with syntax and examples.

Description

The MySQL MD5 function returns an MD5 128-bit checksum representation of a string.

Syntax

The syntax for the MD5 function is:

MD5( string )

Parameters or Arguments

string

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

Note

  • The MD5 function will return a 32 character hex string as the result.
  • The MD5 function will return NULL, if the string was NULL.
  • The result from the MD5 function can be used a hash key.

Applies To

The MD5 function can be used in the following versions :

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23.2

Example

Let’s look at some MD5 function examples and explore how to use the MD5 function.

For example:

mysql> SELECT MD5('abc');
Result: '900150983cd24fb0d6963f7d28e17f72'

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

mysql> SELECT MD5('adglob');
Result: 'f72cde15c34b7201d462392fffdb547f'

mysql> SELECT MD5(NULL);
Result: NULL

Next Topic : Click Here

This Post Has One Comment

Leave a Reply