 <p>For clarifying your situation, you can run the command in your mysql console. If succeeds, then you can try it in your code.</p> <p>First try,</p> <pre><code>LOAD DATA LOCAL INFILE '/tmp/foo.txt' INTO TABLE tmp; </code></pre> <p>Second try,</p> <pre><code>LOAD DATA LOCAL INFILE '/tmp/foo.txt' INTO TABLE tmp COLUMNS TERMINATED BY '\t'; </code></pre> <p>Third try,</p> <pre><code>LOAD DATA LOCAL INFILE '/tmp/foo.txt' INTO TABLE tmp FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'; </code></pre> <p>Forth try,</p> <pre><code>LOAD DATA LOCAL INFILE '/tmp/mydata.txt' INTO TABLE tmp COLUMNS TERMINATED BY '\t' ## This should be your delimiter OPTIONALLY ENCLOSED BY '"'; ## ...and if text is enclosed, specify here </code></pre> <p>From those, which runs perfectly, you can implement your code.</p> <p>For more, You can go through <a href="http://dev.mysql.com/doc/refman/5.7/en/loading-tables.html" rel="nofollow">MySQL manual</a></p> <h2>Resource Link:</h2> <p><a href="https://dev.mysql.com/doc/refman/5.6/en/load-data.html" rel="nofollow">LOAD DATA INFILE Syntax</a></p>