title: Rails and max_allowed_packet
body: <p>This is ruby code:</p>
  <blockquote>
  <p>file = ActiveRecord::Base.connection.execute(&quot;select LOAD_FILE('#{full_file_path}')&quot;).fetch_row()[0]</p>
  </blockquote>
  <p>The file is 180M and my <code>max_allowed_packet</code> in my.cnf was set to 100M, so I changed it to 500M with:</p>
  <pre><code>set global max_allowed_packet=524288000;
  </code></pre>
  <p>The value is changed:</p>
  <pre><code>mysql&gt; show variables like 'max_allowed_packet';
  +--------------------+-----------+
  | Variable_name      | Value     |
  +--------------------+-----------+
  | max_allowed_packet | 524288000 |
  +--------------------+-----------+
  1 row in set (0.00 sec)
  </code></pre>
  <p>But I still got error.</p>
  <blockquote>
  <p>From <a href="http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_max_allowed_packet" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_max_allowed_packet</a></p>
  <p>When you change the message buffer size by changing the value of the max_allowed_packet variable, <strong>you should also change the buffer size on the client side if your client program permits it.</strong> <strong>The default max_allowed_packet value built in to the client library is 1GB, but individual client programs might override this.</strong> For example, mysql and mysqldump have defaults of 16MB and 24MB, respectively. They also enable you to change the client-side value by setting max_allowed_packet on the command line or in an option file.</p>
  </blockquote>
  <p>So maybe ruby mysql client have some small value, and changing on server side is not enough?</p>