title: How to change max_allowed_packet size
body: <p>I am having a problem with BLOB fields in my MySQL database - when uploading files larger than approx 1MB I get an error <code>Packets larger than max_allowed_packet are not allowed.</code></p>
  
  <p>Here is what i've tried:</p>
  
  <p>In MySQL Query Browser I ran a <code>show variables like 'max_allowed_packet'</code> which gave me 1048576. </p>
  
  <p>Then I execute the query <code>set global max_allowed_packet=33554432</code> followed by <code>show variables like 'max_allowed_packet'</code> - it gives me 33554432 as expected.</p>
  
  <p>But when I restart the MySQL server it magically goes back to 1048576. What am I doing wrong here?</p>
  
  <p>Bonus question, is it possible to compress a BLOB field?</p>