mysql> select to_binary('ABAB', 'hex');
+----------------------------------------------------+
| to_binary('ABAB', 'hex') |
+----------------------------------------------------+
| 0xABAB |
+----------------------------------------------------+
1 row in set (0.01 sec)
mysql> select to_binary('U1RBUlJPQ0tT', 'encode64');
+------------------------------------------------------------------------------+
| to_binary('U1RBUlJPQ0tT', 'encode64') |
+------------------------------------------------------------------------------+
| 0x53544152524F434B53 |
+------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select to_binary('STARROCKS', 'utf8');
+----------------------------------------------------------------+
| to_binary('STARROCKS', 'utf8') |
+----------------------------------------------------------------+
| 0x53544152524F434B53 |
+----------------------------------------------------------------+
1 row in set (0.00 sec)
-- The input string does not match the binary format and an empty binary is returned.
mysql> select to_binary('U1RBUlJPQ0tT', 'hex');
+--------------------------------------------------------------------+
| to_binary('U1RBUlJPQ0tT', 'hex') |
+--------------------------------------------------------------------+
| 0x |
+--------------------------------------------------------------------+
1 row in set (0.00 sec)