MySQL import and export problem
Use --hex-blob:

mysql&gt; create database dbase;
Query OK, 1 row affected (0.00 sec)

mysql&gt; use dbase;
Database changed
mysql&gt; create table hexhex ( id binary(16) );
Query OK, 0 rows affected (0.01 sec)

mysql&gt; insert into hexhex values (UNHEX('DEADBEEF'));
Query OK, 1 row affected (0.01 sec)

mysql&gt; select * from hexhex;
+------------------+
| id               |
+------------------+
| ޭ▒               |
+------------------+
1 row in set (0.00 sec)

mysql&gt; quit
Bye
root@ironforge:~# mysqldump --hex-blob -p dbase &gt; dbase.sql
Enter password:
root@ironforge:~#


This produces INSERT statements in the format:

INSERT INTO `hexhex` VALUES (0xDEADBEEF000000000000000000000000);


.. which are import-safe.

Re-import it, and check it's right:

root@ironforge:~# mysql -p dbase &lt; dbase.sql
Enter password:
root@ironforge:~# mysql -p dbase

mysql&gt; use dbase;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql&gt; select * from hexhex;
+------------------+
| id               |
+------------------+
| ޭ▒               |
+------------------+
1 row in set (0.01 sec)

mysql&gt; select hex(id) from hexhex;
+----------------------------------+
| hex(id)                          |
+----------------------------------+
| DEADBEEF000000000000000000000000 |
+----------------------------------+
1 row in set (0.00 sec)

mysql&gt;