Name
ENCODE()
Synopsis
ENCODE(string
,password
)
This function encrypts a given string in binary format and
locks it with the password. You should not use this function for the
password
column in the user
table of the mysql
database. Use PASSWORD() instead. Here is an example:
UPDATE teachers SET pwd = ENCODE('test', 'oreilly') WHERE teacher_id = '730522';
The function here encrypts the word test
and
locks it with the oreilly password. The results
are stored in the pwd
column for the chosen
teacher. To unlock the results, use the DECODE()
function with the same password.
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.