ENCODE(string,password)

Description: Encodes string using password as the password, returning the encoded result.

The result can be decoded using DECODE(). The result is in binary and has the same length as that of string, so if saving the result, a BLOB column type of suitable length should be used.

Examples:

  • ENCODE('My secret message','my_pass') returns a binary string (unprintable).

See also: AES_ENCRYPT(), DECODE(), ENCRYPT(), MD5(), PASSWORD()

Get Sams Teach Yourself MySQL in 21 Days, Second 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.