Does mysqldump handle binary data reliably?

后端 未结 3 1596
小鲜肉
小鲜肉 2020-12-31 00:38

I have some tables in MySQL 5.6 that contain large binary data in some fields. I want to know if I can trust dumps created by mysqldump and be sure that those b

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 01:07

    The dumps generated from mysqldump can be trusted.

    To avoid problems with encodings, binary transfers, etc, use the --hex-blob option, so it translates each byte in a hex number (for example, 'abc' becomes 0x616263). It will make the dump bigger, but it will be the most compatible and secure way to have the info (since it will be pure text, no weird misinterpretations due to special symbols generated with the binary data on a text file).

    You can ensure the integrity (and speed up the transfer) of the dump files packing it on a rar or zip file. That way you can easily detect that it didn't get corrupted with the transfer.

    When you try to load it on your server, check you have assigned on your my.cnf server config file

    [mysqld]
    max_allowed_packet=600M
    

    or more if needed.

    BTW right now i just did a migration, and dumped lots of binary data with mysqldump and it worked perfectly.

提交回复
热议问题