Search code examples
mysqlhadoopmysqlimport

Import HDFS data file into mysql


I am trying to import a large HDFS file into a mysql db. The data in the file is delimiter by a '^A'. How do I tell mysql to separate each column by ctrl-A? Also, is it possible for me to specify what fields I want to import.


Solution

  • See the documentation here:

    http://dev.mysql.com/doc/refman/5.5/en/mysqlimport.html

    You are looking for the --fields-terminated-by=string option. There is not option to only select certain fields for import, though you can use --columns=column_list to map columns in your data to fields in the table.