How to save password in sqoop password file

I want to save the password to a file and then use it in the sqoop command.

According to sqoop documentation --password-file, we can store a password. therefore, I store it in the pwd file only with the password text abc. and executes the command below.

sqoop import --connect jdbc:mysql://localhost:3306/db --username bhavesh --password-file /pwd --table t1 --target-dir '/erp/test' 

Assuming the pwd file is stored on HDFS

As a result, I get the following error:

java.sql.SQLException: Access denied for user 'bhavesh'@'localhost' (using password: YES)

When I perform the same operation using the -p option, it works fine for me.

+4
source share
1 answer

For the saved sqoop job, I was getting the same error. I saved the password in the metastore and it worked for me.

sqoop-site.xml, -/etc/sqoop/conf/sqoop-site.xml

<property>
    <name>sqoop.metastore.client.record.password</name>
    <value>true</value>
    <description>If true, allow saved passwords in the metastore.
    </description>
</property>

sqoop , .

sqoop job --show [_]

+1

All Articles