How to use load data local infile command?

0 votes

How to run this command "LOAD DATA LOCAL INFILE" in CentOS to load a file in SQL database? I am not able to run this because I don't know where to execute it. Tried on terminal but getting command not found error. Tried adding SQL username and password as arguments but no use. So please help me out. 

Feb 4 in Big Data Hadoop by Kamal
42 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

This command should be executed in MySQL console and not in the terminal. 

First, start the MySQL service: 

sudo service mysqld start

When asked for the password, enter the password and hit Enter. To open MySQL console, run this:

mysql -u root -p

When asked for the password, enter the password and hit enter.

Next create a database:

create database <databasename>;
use <databasename>;

Replace <databasename> with the name you want for the database.

Then create a table:

create table <tablename>(<parameters>);

Now you can load the data. Refer to the following example:

LOAD DATA LOCAL INFILE 'abc.csv' INTO TABLE abc FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES (col1, col2, col3, col4, col5...);
answered Feb 4 by Omkar
• 65,850 points

Related Questions In Big Data Hadoop

0 votes
1 answer

Hey for all, how to get on large data i want use in hadoop?

Hey! You can get large data-sets for ...READ MORE

answered Apr 24 in Big Data Hadoop by Ariba
25 views
0 votes
1 answer

How to load data from HDFS into pig relation?

Hey, To load data from HDFS to pig ...READ MORE

answered May 7 in Big Data Hadoop by Gitika
• 8,380 points
10 views
0 votes
1 answer

How to use data compression in sqoop import?

You can enable data compression from the ...READ MORE

answered May 15 in Big Data Hadoop by Rocky
14 views
0 votes
1 answer

Update hdfs data before stroring in MySql

Yes, you can update the data before ...READ MORE

answered Jan 27 in Big Data Hadoop by Omkar
• 65,850 points
18 views
0 votes
1 answer

Using Hadoop for Data Analytics.

Yes, your approach is correct - you ...READ MORE

answered Sep 28, 2018 in Big Data Hadoop by Frankie
• 9,590 points
23 views
0 votes
1 answer

How to open MySql console in Ubuntu?

sudo service mysqld restart mysql -u <username> root ...READ MORE

answered Dec 14, 2018 in Big Data Hadoop by Omkar
• 65,850 points
62 views
0 votes
1 answer

Facing the below error while installing mysql in VM

We would like to say that the ...READ MORE

answered Dec 21, 2018 in Big Data Hadoop by Omkar
• 65,850 points
40 views
0 votes
1 answer

Hadoop: How to use Jps command with Sun JDK installed?

You can put JPS into your path ...READ MORE

answered Nov 9, 2018 in Big Data Hadoop by Omkar
• 65,850 points
100 views
0 votes
1 answer

Hive: How to use insert query like SQL

It is now possible to insert like ...READ MORE

answered Nov 5, 2018 in Big Data Hadoop by Omkar
• 65,850 points
27 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.