title: How to import LARGE sql files into mysql table
body: <p>I have a php script that parses XML files and creates a large SQL file that looks something like this:</p>
  
  <pre><code>INSERT IGNORE INTO table(field1,field2,field3...)
  VALUES ("value1","value2",int1...),
  ("value1","value2",int1)...etc
  </code></pre>
  
  <p>This file adds up to be over 20GB (I've tested on a 2.5GB file but it fails too).</p>
  
  <p>I've tried commands like:</p>
  
  <blockquote>
    <p>mysql -u root -p table_name &lt; /var/www/bigfile.sql</p>
  </blockquote>
  
  <p>this works on smaller files, say around 50MB. but it doesn't work with a larger file.</p>
  
  <p>I tried:</p>
  
  <pre><code>mysql&gt; source /var/www/bigfile.sql
  </code></pre>
  
  <p>I also tried mysqlimport but that won't even properly process my file.</p>
  
  <p>I keep getting an error that says</p>
  
  <pre><code>ERROR 2006 (HY000): MySQL server has gone away
  </code></pre>
  
  <p>Happens approx. 30 seconds after I start executing.</p>
  
  <p>I set allowed_max_packet to 4GB but when verifying it with SHOW VARIABLES it only shows 1GB.</p>
  
  <p>Is there a way to do this without wasting another 10 hours?</p>