Syntax
HEX(str)
Purpose
Converts the numeric or string str to a hexadecimal string, where each byte of each character in str is converted to two hexadecimal digits.
For a numeric parameter N, UNHEX(N) is not the inverse of HEX(N). In this case, you can use CONV(HEX(N),16,10) instead.
Examples
obclient> SELECT HEX(255), HEX('abc');
+----------+------------+
| HEX(255) | HEX('abc') |
+----------+------------+
| FF | 616263 |
+----------+------------+
1 row in set
