• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 887
  • Last Modified:

LOAD DATA INFILE from command line

Hello,

I have root access to a remote Linux server running CentOS with MySQL installed.

I want to populate a database from a text file at the command-line prompt.

This does NOT work:

mysql --user=user_user -password=password user_DB; LOAD DATA INFILE 'generated.txt' INTO TABLE myTable FIELDS TERMINATED BY '||';

What am I doing wroing?
0
hankknight
Asked:
hankknight
1 Solution
 
hbustanCommented:
Try specifying the field names in your line such as:

mysql --user=user_user -password=password user_DB; LOAD DATA INFILE 'generated.txt' INTO TABLE myTable FIELDS TERMINATED BY '||' (Field1,Field2,Field3);
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now