SET @var = b'01011010';
SELECT BIN(@var);
Note that 01011010 == 'Z';
Returns:
+-----------+
| BIN(@var) |
+-----------+
| 0 |
+-----------+
MySql manual states:
"Bit values are returned as binary values. To display them in printable form, add 0 or use a conversion function such as BIN(). "
Why does this conversion function not work properly and to actually get 'Z' all you need to do is select @var:
SELECT @var;
+------+
| @var |
+------+
| Z |
+------+