String Functions MySQL Tutorial

If N_or_S is a number, returns a string representation of the hexadecimal value of N.
If N_or_S is a string, returns a hexadecimal string representation of N_or_S where each character in N_or_S is converted to two hexadecimal digits.

mysql>
mysql> SELECT HEX(255);
+----------+
| HEX(255) |
+----------+
| FF       |
+----------+
1 row in set (0.00 sec)
mysql>