title: Got error message in LOAD DATA LOCAL INFILE
body: <p>I've got this error:</p>
  
  <pre><code>Error message is :: "Error occured during query execution: (LOAD DATA LOCAL INFILE '/tmp/3sch.jofcial.txtgymCN5' REPLACE INTO TABLE `prod_sch` FIELDS TERMINATED BY ',' IGNORE 1 LINES (No_ ,Model_Code,Model_Name ,Lot_No_ ,Start_Seq_No_ ,Quantity ,Lot_Quantity ,Line_Code ,Line_Name ,@var10, Shift_No1,@var12,Shift_No2,@var14,Production_Mngm_Type,Model_Group,Model_Category,Actual_Results,MPS_Mngm_Code, Production_Mngm_Code,Comment) SET Production_Start_Date=STR_TO_DATE(@var10,'%m/%d/%Y'), Production_Finish_Date=STR_TO_DATE(@var12,'%m/%d/%Y'), Due_date=STR_TO_DATE(@var14,'%m/%d/%Y')): The used command is not allowed with this MySQL version";
  </code></pre>
  
  <p>After try this syntax:</p>
  
  <pre><code>$temp_file = tempnam(sys_get_temp_dir(), '3sch.jofcial.txt');  // make temporary file name
  $fp = fopen($temp_file, "wb");          // open temprary file
  if (!$fp) die(_ERROR14);
  fwrite($fp, $httpfile);                         // copy to temporary file from schedule file
  fclose($fp);
  chmod($temp_file, 0644);                        // file mode change for read only
  
  $sql="TRUNCATE TABLE `prod_sch`";
  $res=mysql_query($sql) ;//or _doError(_ERROR30 . ' (&lt;small&gt;' . htmlspecialchars($sql) . '&lt;/small&gt;): ' . mysql_error() );  // submit SQL to MySQL $
  $sql="LOAD DATA LOCAL INFILE '".$temp_file."' REPLACE INTO TABLE `prod_sch` FIELDS TERMINATED BY ',' IGNORE 1 LINES "; // FIELDS ENCLOSED BY '\"'$
  $sql.="(No_ ,Model_Code,Model_Name ,Lot_No_ ,Start_Seq_No_ ,Quantity ,Lot_Quantity ,Line_Code ,Line_Name ,@var10, ";
  $sql.="Shift_No1,@var12,Shift_No2,@var14,Production_Mngm_Type,Model_Group,Model_Category,Actual_Results,MPS_Mngm_Code, ";
  $sql.="Production_Mngm_Code,Comment) ";
  $sql.="SET Production_Start_Date=STR_TO_DATE(@var10,'%m/%d/%Y'), ";
  $sql.="Production_Finish_Date=STR_TO_DATE(@var12,'%m/%d/%Y'), ";
  $sql.="Due_date=STR_TO_DATE(@var14,'%m/%d/%Y')";
  
  $res=mysql_query($sql) or _doError(_ERROR30 . ' (&lt;small&gt;' . htmlspecialchars($sql) . '&lt;/small&gt;): ' . mysql_error() );  // submit SQL to MySQL and$
  unlink($temp_file);
  </code></pre>
  
  <p>This error happen after restore the backup file into new server. From the error message I can see that the temporary file already created.</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have try:</p>
  
  <p><code>mysql --load-infile -u root -p pwd DBname</code></p>
  
  <p>then try to put the query above inside <code>&gt;mysql</code>, this query can work.
  But, why if i using php it doesn't?</p>
  
  <p>try to edit /etc/mysql/my.cnf:
  <code>add local-infile = 1</code>
  still can't work.
  this the <a href="http://pastebin.com/N2jpTdvW" rel="nofollow">php page</a></p>