MySQL - Blank fields in tab-delimited .txt file causing errors in LOAD DATA INFILE
Use SET form of LOAD DATA INFILE (load the whole line into a user-defined variable and then parse it into separate fields). 

Example:

LOAD DATA INFILE 'The/path/to/my/file.txt'
INTO TABLE my_table
IGNORE 1 ROWS
( @temp )
SET @count = LENGTH(@temp) - LENGTH(REPLACE(@temp, '\t', '')),
    id = CASE WHEN @count &gt; 0 
              THEN SUBSTRING_INDEX(@temp, '\t', 1) 
              ELSE NULL END,
    field1 = CASE WHEN @count &gt; 1 
                  THEN SUBSTRING_INDEX(SUBSTRING_INDEX(@temp, '\t', 2), '\t', -1)  
                  ELSE DEFAULT() END,
    field2 = CASE WHEN @count &gt; 2  
                  THEN SUBSTRING_INDEX(SUBSTRING_INDEX(@temp, '\t', 3), '\t', -1)  
                  ELSE CURRENT_TIMESTAMP END,
    /* and similar expressions for all another fields */


The problem is that a record is inserted always - ever if a line is empty. So you need to remove those "empty" records after importing, and set some correct literal values to NOT-NULL fields which do not have default value.


  Depending on the column, it may be of type Date or Int.


You can easily create unique parsing statement for each separate field dependent by its data type. Like

fieldX = CASE WHEN @count &gt; X  
              THEN some_parsing_function_or_expression(SUBSTRING_INDEX(SUBSTRING_INDEX(@temp, '\t', X+1), '\t', -1))  
              ELSE {default value proper for field's data type} END,


or the same using intermediate variable

@tmpX = CASE WHEN @count &gt; X  
             THEN SUBSTRING_INDEX(SUBSTRING_INDEX(@temp, '\t', X+1), '\t', -1))  
             ELSE 'default value proper for field data type' END,
fieldX = CASE WHEN @tmpX = 'default value proper for field data type'
              THEN @tmpX
              ELSE some_parsing_function_or_expression(@tmpX) END,