Validate Sqoop and MySQL integration using "sqoop list-databases"


Let us see how we can list databases using Sqoop.

  • We will be using MySQL to connect to and list database.
  • To list databases we need to use following common arguments.
    • –connect to pass JDBC URI
    • –username to pass Username
    • –password or -P or –password-file to pass the passwor.
  • For now we will use –password for passing the password.
  • We need to build the JDBC URL based on the database we are trying to connect to.

Here is the command to connect to MySQL Database over JDBC and list the databases.

  • To list databases we need not have database name in JDBC URI.
  • MySQL runs on port number 3306 by default. For default port number, we don’t need to specify as part of JDBC URI.
sqoop list-databases \
  --connect "jdbc:mysql://" \
  --username retail_user \
  --password itversity