Hex and Binary Literals in MySQL / MariaDB?
This is expected behaviour in MariaDB since versions 10.0.3 and 5.5.31. It looks like you're running the queries in MariaDB, but reading the MySQL docs. These are similar, but diverging RDBMSes.

According to the MariaDB documentation on hexadecimal literals:


  The first two syntaxes; X'value' and x'value, follow the SQL standard,
  and behave as a string in all contexts in MariaDB since MariaDB 10.0.3
  and MariaDB 5.5.31 (fixing MDEV-4489). The latter syntax, 0xvalue, is
  a MySQL/MariaDB extension for hex hybrids and behaves as a string or
  as a number depending on context. MySQL treats all syntaxes the same,
  so there may be different results in MariaDB and MySQL (see below).


The queries in your example will give warnings such as:


  | Warning | 1292 | Truncated incorrect INTEGER value: '\x01' |


So you can get your desired behaviour by using the non-standard 0xvalue syntax:

SELECT 0x01 &amp; B'00000001', 0x01 &amp; 0x01, B'00000001' &amp; B'00000001';


Which gives:

+--------------------+-------------+---------------------------+
| 0x01 &amp; B'00000001' | 0x01 &amp; 0x01 | B'00000001' &amp; B'00000001' |
+--------------------+-------------+---------------------------+
|                  1 |           1 |                         1 |
+--------------------+-------------+---------------------------+