BINARY(n) ,varBINARY(n): N代表字节数
utf8: mysql> CREATE TABLE t (c BINARY());
Query OK, rows affected (0.04 sec) mysql> INSERT INTO t SET c = 'a';
Query OK, row affected (0.19 sec) mysql> SELECT HEX(c), c = 'a', c = 'a\0\0' from t;
+--------+---------+-------------+
| HEX(c) | c = 'a' | c = 'a\0\0' |
+--------+---------+-------------+
| | | |
+--------+---------+-------------+
row in set (0.01 sec) mysql> CREATE TABLE tr (c varBINARY());
Query OK, rows affected (0.04 sec) mysql> INSERT INTO tr SET c = 'a';
Query OK, row affected (0.00 sec) mysql> SELECT HEX(c), c = 'a', c = 'a\0\0' from tr;
+--------+---------+-------------+
| HEX(c) | c = 'a' | c = 'a\0\0' |
+--------+---------+-------------+
| | | |
+--------+---------+-------------+
row in set (0.01 sec)