How to reliably restore MySQL blobs

ⅰ亾dé卋堺 提交于 2019-12-03 06:13:14
George

I managed to back up and restore the blobs by using the following mysqldump command:

mysqldump --opt  --skip-extended-insert --max_allowed_packet=128M -u root myDB > filename

Not sure if it’s specifying max_allowed_packet on the command line or the skip-extended-insert that did the trick.

I assumed that my max_allowed_packet of 32M was being used, but I think that in the mysql config file it is in the [mysqld] section and so probably does not apply to dump.

I still don’t understand why I got no errors on either the dump or the restore.

Leopd

mysqldump --skip-extended-insert works but can reduce performance by 100x on restore, making it not a viable choice.

When you do the backup, max_allowed_packet is ignored by mysqldump (by design?) The actual complement is net_buffer_length. So make sure your max_allowed_packet is bigger than your net_buffer_length and it should work. As in:

mysqldump -u root --net_buffer_length=100k oldDB > backup.sql
mysql -u root --max_allowed_packet=10M newDB < backup.sql
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!