TO_BASE64 function in mysql is used for encode any string with the string encode rule BASE64. This function returns a encoded string.
This function is added with the mysql version 5.6.1
In mysql there is different base-64 encoding schemes exist. These are the encoding and decoding rules used by TO_BASE64() and FROM_BASE64():
-> The encoding for alphabet value 62 is '+'.
-> The encoding for alphabet value 63 is '/'.
-> Encoded output consists of groups of 4 printable characters. Each 3 bytes of the input data are encoded using 4 characters. If the last group is incomplete, it is padded with '=' characters to a length of 4.
-> A newline is added after each 76 characters of encoded output to divide long output into multiple lines.
-> Decoding recognizes and ignores newline, carriage return, tab, and space.
Here is a example in which I encode a sring by BASE64 encoding rule-