title: ERROR 2006 (HY000): MySQL server has gone away. It looks like MySQL doesn't take the settings from the my.cnf file
body: <p>I want import a big file ( 10GB) in MySQL in Ubuntu
  with this command: 
      <code>mysql -u root -p &lt; name database&gt; &lt; path the the file to import</code>      .</p>
  
  <p>Then I get this error: ERROR 2006 (HY000): MySQL server has gone away</p>
  
  <p>In my.cnf I added:
      <code>[mysqld]
  max_allowed_packet=2048M</code></p>
  
  <p>Then I go to the MySQL console with 
        <code>mysql -u root -p</code></p>
  
  <p>Using:
        <code>Select @@global.max_allowed_packet;</code><br>
  I see a much lower value as I wrote in my.cnf.</p>
  
  <p>The value is still low after restarting the service with
        <code>sudo /etc/init.d/mysql restart</code></p>
  
  <p>When I use<br>
      <code>SET GLOBAL max_allowed_packet=1073741824;</code><br>
  in the MySQL console, THEN the max_allowed_packet value is changed. </p>
  
  <p>After this I start
        <code>MySQL -u root -p &lt; name database&gt; &lt; path the the file</code><br>
  to import again. Now there is no error and the file is imported.</p>
  
  <p>The mysql file is in
       '    /etc/mysql    ', the my.cnf file is also in
       '/etc/mysql'</p>
  
  <p>It looks like MySQL doesn't take the settings from the my.cnf file.</p>