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 in Apache Spark by Karan
14 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 by Jishan

Related Questions In Apache Spark

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,240 points
993 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,190 points
447 views
0 votes
1 answer

How to convert rdd object to dataframe in spark

SqlContext has a number of createDataFrame methods ...READ MORE

answered May 30, 2018 in Apache Spark by nitinrawat895
• 10,110 points
1,025 views
0 votes
1 answer
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
• 67,120 points
20 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,810 points
30 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
• 67,120 points
69 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
• 67,120 points
47 views
0 votes
4 answers

How to change the spark Session configuration in Pyspark?

You can dynamically load properties. First create ...READ MORE

answered Dec 10, 2018 in Apache Spark by Vini
10,496 views
0 votes
6 answers