QBoard » Big Data » Big Data - Data Ingestion Tools : Sqoop, Flume, Kafka, Nifi.. » Sqoop Import --password-file function not working properly in sqoop 1.4.4

Sqoop Import --password-file function not working properly in sqoop 1.4.4

  • I am using hadoop-1.2.1 and sqoop version is 1.4.4.

    I am trying to run the following query.

    sqoop import --connect jdbc:mysql://IP:3306/database_name --table clients --target-dir /data/clients --username root --password-file /sqoop.password -m 1

    sqoop.password is a file which is kept on HDFS in path /sqoop.password with permission 400.

    It is giving me an error

    Access denied for user 'root'@'IP' (using password: YES)

    Can anyone provide solution for this? 

      October 12, 2020 12:58 PM IST
    0
  • While creating password, use echo -n option. (-n option removes all trailing spaces).Suppose you have a password "myPassword" and you want to save it to a file sqoop.password, then follow  below steps:
    1. Create password using command

      echo -n "myPassword" > sqoop.password
    2. Upload the file to HDFS as the file needs to be present in HDFS

      hadoop fs -put sqoop.password /user/keepMyFilesHere
    3. Write the scoop import command

      sqoop list-tables --connect jdbc:mysql://localhost/kpdatabase --username root --password-file /user/karanpreet.singh/sqoop.password
      

    This will definitely work!

    This post was edited by Jasmine Chacko at October 14, 2020 11:13 AM IST
      October 12, 2020 3:11 PM IST
    0
  • Not sure if you are still having this issue. The password file can be in any folder. Try the following syntax and it should work:

    --password-file file:///user/root/database.password
      October 12, 2020 3:12 PM IST
    0
  • Check if there is any garbage character in your password file. I was getting the same issue and finally found that the file contained a \n character at the end and sqoop considered that also as a part of the password string. Try creating a password file as mentioned below and than use the password file : echo -n "root_password" > password.txt Place your password in place of root_password.
      October 14, 2020 11:10 AM IST
    0
  • "\n" is being written in file when you vi the file and write the password. Better use the below approach to avoid problems

    echo -n "Your_sqoop_password" > sqoop.password

     

      October 14, 2020 11:15 AM IST
    0