MySQL - Loading a text file into ue table

April 2018

  • To load a text file, perform as follow:

$ tail /home/user1/test.txt 
  • In a table defined as follows:

CREATE TABLE chargertest ( 
                prim_key int(11) NOT NULL auto_increment, 
                name varchar(20), 
                x integer, 
                y integer, 
                z timestamp(14), 
                Constraint pk_chargertest PRIMARY KEY  (prim_key) 
  • Note that the 'z' is not defined in the text file and the separator is','.

mysql> load data infile '/home/user1/test.txt' into table chargertest fields terminated by ',' (name,x,y);
Published by jak58. Latest update on April 24, 2010 at 07:34 AM by jak58.
This document, titled "MySQL - Loading a text file into ue table," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (
Avoid being blocked in case of the error :TOO MANY CONNECTIONS
MySQL - Linux Monitoring port 3306