TO_BASE64()
Function description
The TO_BASE64() function is used to convert a string to a Base64-encoded string. If the argument is not a string, it is converted to a string before conversion. If the parameter is NULL, the result is NULL.
The Base64 encoded string can be decoded using the FROM_BASE64() function.
Function Syntax
> TO_BASE64(str)
Parameter definition
| Parameters | Description |
|---|---|
| str | Required parameters. To convert to Base64 encoded string |
Example
mysql> SELECT TO_BASE64('abc');
+---------------------+
| to_base64(abc) |
+---------------------+
| YWJj |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT TO_BASE64(255);
+---------------------+
| to_base64(255) |
+---------------------+
| MjU1 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT TO_BASE64(null);
+-----------------------+
| to_base64(null) |
+-----------------------+
| NULL |
+-----------------------+
1 row in set (0.01 sec)