Updated on 2023-11-30 GMT+08:00

Connecting Sqoop to MySQL

Issue

The user does not know how to connect to a MySQL database.

Procedure

  1. Install the client in the cluster and check whether the MySQL driver package exists in the sqoop/lib directory of the client.

  2. Load environment variables in the client directory.

    source bigdata_env

  3. Perform Kerberos user authentication.

    If Kerberos authentication is enabled for the cluster, run the following command to authenticate the user who has the operation permission. Otherwise, skip this step.

    kinit MRS cluster user

  4. Connect to the database. There can be security risks if a command contains the authentication password. You are advised to disable the command recording function (history) before running the command.

    sqoop list-databases --connect jdbc:mysql://Database IP address:3306/ --username Database login username --password Password

    The command output shows that Sqoop is successfully connected to the MySQL database.