HEX
Syntax
HEX(str)
Description
Converts the number 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
SELECT HEX(255), HEX('abc');
+----------+------------+
| HEX(255) | HEX('abc') |
+----------+------------+
| FF | 616263 |
+----------+------------+
1 row in set (0.001 sec)