How to decode a string in mysql

 

 

Use DECODE( )
complete synatx of DECODE(string, password)
This function decrypts a given string that was encrypted with a given password. See the
ENCODE( ) function
SELECT ENCODE(pwd, ‘joseph’)
FROM nurses
WHERE nurse_id = ‘2332’;

This function decrypts the contents of the pwd column
and unlocks it using the joseph password,
which was used to encrypt it originally using ENCODE( ).
how to decrypt in mysql
DES_DECRYPT(string, [key])
This function decrypts text that was encrypted using the triple Data Encryption Standard
(DES) algorithm with a 128-bit key length, reversing the DES_ENCRYPT( ) function. It returns
NULL if an error occurs. The function will work only if MySQL has been configured
for Secure Sockets Layer (SSL) support. It is available as of version 4.0.1 of MySQL. Here
is an example:
SELECT DES_DECRYPT(loan_security_number, 0)
FROM orders
WHERE order_no = ‘1223’;
the value for the loan_security_number column is decrypted using the first key
string in the key file.
syntax for encrypt in mysql
UPDATE orders
SET credit_card_nbr = DES_ENCRYPT(‘9081-1231-1111’)
WHERE order_no = ‘1223’;

what does md5 function:
MD5( )
MD5(string)
This function uses a Message-Digest algorithm 5 (MD5) 128-bit checksum to return a
32-character hash value of string from the Request for Comments (RFC) 1321 standard.

how to set password in mysql
PASSWORD(string)
This function encrypts a password given as an argument. The result cannot be decrypted.
This function is used for encrypting data in the password column of the user table in the
mysql database. Here is an example:
UPDATE nurses
SET pwd = PASSWORD(‘test’)
WHERE nurse_id = ‘221’;

mysql tutorial