I am having a problem with BLOB fields in my MySQL database - when uploading files larger than approx 1MB I get an error Packets larger than max_allowed_packet are not allowed.
Here is what i've tried:
In MySQL Query Browser I ran a show variables like 'max_allowed_packet'
which gave me 1048576.
Then I execute the query set global max_allowed_packet=33554432
followed by show variables like 'max_allowed_packet'
- it gives me 33554432 as expected.
But when I restart the MySQL server it magically goes back to 1048576. What am I doing wrong here?
Bonus question, is it possible to compress a BLOB field?
Change in the my.ini
or ~/.my.cnf
file by including the single line under [mysqld]
or [client]
section in your file:
max_allowed_packet=500M
then restart the MySQL service and you are done.
See the documentation for further information.