Unable to import database from mysql using sqoop in lab session

sqoop

#1

Hi Team,
I am learning sqoop functionality from videos and I was trying to import retail_db database in mysql into hdfs path “/user/dakula1268/mysql_import”. I used below commands to execute the same. however I am unable to run the command for some reason. Need some help to move forward. Attached are the screenshot of the commands that I used.

I wanted to sqoop import database “retail_db” which is on nn01.itversity.com server.

Commands:

[dakula1268@gw02 ~]$ sqoop list -databases --connect “jdbc:mysql://nn01.itversity.com:3306”–username retail_dba --password itversity
Warning: /usr/hdp/2.5.0.0-1245/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
No such sqoop tool: list. See ‘sqoop help’.
[dakula1268@gw02 ~]$ sqoop list -databases --connect “jdbc:mysql://nn01.itversity.com”–username retail_dba --password itversity
Warning: /usr/hdp/2.5.0.0-1245/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
No such sqoop tool: list. See ‘sqoop help’.

Best
Deepthi


#2

@dakula1268

- is missing before databases. required and give space before –username

The command which you mentioned is to list the databases in mysql.
sqoop list --databases --connect “jdbc:mysql://nn01.itversity.com:3306” –username retail_dba --password itversity

You can import all tables in the database. Try below command:
sqoop import-all-tables --connect “jdbc:mysql://nn01.itversity.com:3306/retail_db” --username retail_dba --password itversity --warehouse-dir=/user/dakula1268/mysql_import