migrate MySQL database with MySQL Workbench CE failed on table with blob data I am using MySQL Workbench CE to migrate one schema from a server to another, all table is migrated successfully, except one table with blob data.

The error message is :

Found record bigger than max_allowed_packet.


I have set the max_allowed_packet to 1M on target server, and restarted MySQL, but still got the same error.

And I checked data in that table:

select max(OCTET_LENGTH(file_Data)) from attachment;
------
680960
select sum(OCTET_LENGTH(file_Data)) from attachment;
------
5165578


How can this be fixed?
You can see max_allowed_packet to 1G in your session

SET max_allowed_packet = 1073741824;


You can do so because MySQL will not immediately allocate it. A packet can grow. Please note how it mentions this in the MySQL Documentation:


  The packet message buffer is initialized to net_buffer_length bytes, but can grow up to max_allowed_packet bytes when needed. This value by default is small, to catch large (possibly incorrect) packets.
  
  You must increase this value if you are using large BLOB columns or long strings. It should be as big as the largest BLOB you want to use. The protocol limit for max_allowed_packet is 1GB. The value should be a multiple of 1024; nonmultiples are rounded down to the nearest multiple.


You should go ahead and add max_allowed_packet to my.cnf

[mysqld]
max_allowed_packet=1G


That way it is globally available for all incoming connections when you restart mysql. You don't have to restart mysql right now. You can just run:

SET GLOBAL max_allowed_packet = 1073741824;


Give it a Try !!!