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.
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 teacher chosen. To unlock the
results, you can use the DECODE( )
function with
the password.
Get MySQL in a Nutshell 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.