MySQL DES_DECRYPT() function
DES_DECRYPT() function
MySQL DES_DECRYPT() function decrypts an encrypted string and returns the original string.
Syntax:
DES_DECRYPT(crypt_str, [key_str]);
Arguments:
Name | Description |
---|---|
crypt_str | An encrypted string. |
key_str | String to decrypt crypt_str. |
Syntax Diagram:

MySQL Version: 8.0
Example:
Code:
SELECT DES_DECRYPT(DES_ENCRYPT('mytext','mypassward'),'mypassward');
Explanation:
The above MySQL statement decrypts the encrypted string 'mytext' as specified in the argument and returns the original string.
Output:
mysql> SELECT DES_DECRYPT(DES_ENCRYPT('mytext','mypassward'),'mypassward'); +--------------------------------------------------------------+ | DES_DECRYPT(DES_ENCRYPT('mytext','mypassward'),'mypassward') | +--------------------------------------------------------------+ | mytext | +--------------------------------------------------------------+ 1 row in set (0.01 sec)
Example of MySQL des_decrypt() function using table
Sample table: testtable
Code:
SELECT description,DES_DECRYPT(description,'mydespassw')
FROM testtable;
Explanation:
The above MySQL statement retrieves the decrypted data from encrypted 'description' column from 'testtable'.
Output:
Previous: DECODE()
Next: DES_ENCRYPT()
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join