Step 1: Give the below command to start mysql:
sudo service mysqld start
Step 2: To access the MySQL, you need to give the below command:
mysql -u root -p
When the console asks for a password, type the password or just press enter if you dont want a password
create database sample;
use sample;
Now create a table and insert data
Step 3: Now, we have created a database and inside the database, we have also created a table employee and have also loaded the table.
Now to view the table, we give the following command:
select * from employee
Step 4: Now, we are supposed to open another terminal and give the below commands to use sqoop to import tables to hdfs:
sqoop import --connect jdbc:mysql://localhost/sample --table employee --username root --P --target-dir /sqoop_jobs/sqoop1 -m 1
Step 5: Now we can verify import in the hdfs by entering the url of sqoop in the web browser