MySQL Blob Insert Error

When using MySQL to store things such as files, it is best to use a blob field.  If you’re using a blob field, but having trouble with inserting some data into it (like a file), you might want to check the MySQL environment varibale max_allowed_packet.  The max_allowed_packet variable can be found in your configuration file (usually /etc/my.cnf), and is usually set to something around 1 MB.  If you try to insert a binary file larger than 1MB, the MySQL insert will fail.  All that’s needed, is to change to max_allowed_packet to something larger, then, restart MySQL:

MySQL Max Allowed Packet

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*