How to reliably restore MySQL blobs

前端 未结 2 621
谎友^
谎友^ 2021-02-08 14:26

I have been backing up a MySQL database for several years with the command: mysqldump myDatabaseName -u root > myBackupFile.sql

The backups have appeare

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-08 15:20

    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
    

提交回复
热议问题