Collections:
TO_BASE64() - Base64 Encoding
How to encode a byte sequence to a Base64 string using the TO_BASE64() function?
✍: FYIcenter.com
TO_BASE64(bin) is a MySQL built-in function that
encodes a byte sequence to a Base64 string.
For example:
SELECT FROM_BASE64('RllJ'), TO_BASE64('FYI');
-- +---------------------+------------------+
-- | FROM_BASE64('RllJ') | TO_BASE64('FYI') |
-- +---------------------+------------------+
-- | FYI | RllJ |
-- +---------------------+------------------+
SELECT FROM_BASE64('My4xNA=='), TO_BASE64(3.14);
-- +-------------------------+-----------------+
-- | FROM_BASE64('My4xNA==') | TO_BASE64(3.14) |
-- +-------------------------+-----------------+
-- | 3.14 | My4xNA== |
-- +-------------------------+-----------------+
SELECT TO_BASE64('FYI'), TO_BASE64(X'465949'), X'465949';
-- +------------------+----------------------+-----------+
-- | TO_BASE64('FYI') | TO_BASE64(X'465949') | X'465949' |
-- +------------------+----------------------+-----------+
-- | RllJ | RllJ | FYI |
-- +------------------+----------------------+-----------+
Reference information of the TO_BASE64() function:
TO_BASE64(bin): b64 Converts the binary argument to base-64 encoded form and returns the result as a character string with the connection character set and collation. The result is NULL if the argument is NULL. Arguments, return value and availability: bin: Required. The binary sequence. b64: Return value. The Base64 string. Available since MySQL 5.7.
Related MySQL functions:
⇐ SUBSTRING_INDEX() - Substring in Delimited String
2023-11-18, 1081🔥, 0💬
Popular Posts:
How To Convert Numeric Expression Data Types using the CONVERT() Function in SQL Server Transact-SQL...
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...
How To Disable a Login Name in SQL Server? If you want temporarily disable a login name, you can use...
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...