Error Loading data to mysql in Spark

0 votes

Need Help. 

[edureka]> LOAD DATA INFILE "/user/edureka_422446/spark/county_facts_dictionary.csv"
-> INTO TABLE county_facts_dictionary
-> COLUMNS TERMINATED BY ","
-> OPTIONALLY ENCLOSED BY """
-> ESCAPED BY """
-> LINES TERMINATED BY "\n"
-> IGNORE 1 LINES;
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Jul 11, 2019 in Apache Spark by Karan
831 views

1 answer to this question.

0 votes

You have to use sqoop to export data from hdfs to mysql, first you have to create a table in mysql with a schema based on the type of data you have then use the below command to export the data from hdfs to mysql in the web console: 

$ sqoop export --connect jdbc:mysql://sqoopdb.edu.cloudlab.com/databasename --table tabename --username labuser --password edureka -m 1 --fields-terminated-by "," --lines-terminated-by "\n" --export-dir /user/edureka_422446/spark/county_facts_dictionary.csv
answered Jul 11, 2019 by Jishan

Related Questions In Apache Spark

0 votes
1 answer

How to load data of .csv file in MySQL Database Table?

You can do it using a code ...READ MORE

answered Jul 22, 2019 in Apache Spark by Vishwa
1,668 views
+1 vote
1 answer

How to read a data from text file in Spark?

Hey, You can try this: from pyspark import SparkContext SparkContext.stop(sc) sc ...READ MORE

answered Aug 6, 2019 in Apache Spark by Gitika
• 65,910 points
4,711 views
0 votes
1 answer

Efficient way to read specific columns from parquet file in spark

As parquet is a column based storage ...READ MORE

answered Apr 20, 2018 in Apache Spark by kurt_cobain
• 9,390 points
7,328 views
0 votes
1 answer

Getting error while connecting zookeeper in Kafka - Spark Streaming integration

I guess you need provide this kafka.bootstrap.servers ...READ MORE

answered May 24, 2018 in Apache Spark by Shubham
• 13,490 points
2,601 views
0 votes
1 answer

Error: Loading data to mysql

You have to use sqoop to export data ...READ MORE

answered Jul 23, 2019 in Apache Spark by Janan
451 views
0 votes
1 answer

Update hdfs data before stroring in MySql

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

answered Jan 27, 2019 in Big Data Hadoop by Omkar
• 69,210 points
574 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,830 points
521 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
• 69,210 points
2,283 views
0 votes
1 answer

How to handle data shuffle in Spark

Hi, You can do it using map partition ...READ MORE

answered Aug 6, 2019 in Apache Spark by Gitika
• 65,910 points
1,160 views
0 votes
5 answers

How to change the spark Session configuration in Pyspark?

You aren't actually overwriting anything with this ...READ MORE

answered Dec 14, 2020 in Apache Spark by Gitika
• 65,910 points
122,265 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP