title: Sqoop import error: Access denied for user 'root'@'localhost' , even if rights are OK
body: <p>I found a lot of people with the similar error but no tips are working for my problem.</p>
  
  <p>My command line:</p>
  
  <pre><code>sqoop import --connect jdbc:mysql://localhost/databaseY --username=root -P --table tableX --target-dir /user/ec2-user/databaseY/tableX --as-textfile --fields-terminated-by "\t"
  </code></pre>
  
  <p>The error</p>
  
  <pre><code>16/08/19 11:25:51 INFO mapreduce.Job: Job job_1471608424445_0028 running in uber mode : false
  16/08/19 11:25:51 INFO mapreduce.Job:  map 0% reduce 0%
  16/08/19 11:25:58 INFO mapreduce.Job:  map 25% reduce 0%
  16/08/19 11:26:04 INFO mapreduce.Job:  map 50% reduce 0%
  16/08/19 11:26:06 INFO mapreduce.Job: Task Id :     attempt_1471608424445_0028_m_000000_0, Status : FAILED
  Error: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
  </code></pre>
  
  <p>How it is possible that the map start and stop after due to this error?</p>
  
  <p>It looks like I have all the right needed as this two command line are working:</p>
  
  <pre><code>sqoop list-databases --connect jdbc:mysql://localhost --username root -P
  </code></pre>
  
  <p>And</p>
  
  <p>On mysql with root account I can do</p>
  
  <pre><code>select * from databaseY.tableX
  </code></pre>
  
  <p>---EDIT---</p>
  
  <p>This command line is working:</p>
  
  <pre><code>sqoop import --connect jdbc:mysql://localhost/databaseY --username root --password PASSWORD --query "select * from databaseY.tableX where number = 1474 AND \$CONDITIONS" --target-dir /tmp/ok --as-textfile --direct --split-by number
  </code></pre>
  
  <p>but this one no:</p>
  
  <pre><code>sqoop import --connect jdbc:mysql://localhost/databaseY --username root --password PASSWORD --query "select * from databaseY.tableX where 1 = 1 AND \$CONDITIONS" --target-dir /tmp/ok --as-textfile --direct --split-by number
  </code></pre>
  
  <p>Then, I realized that if I use -m 1 my sqoop import is working. Only with <strong>-m 1</strong></p>
  
  <p>Does it mean I have a bad cluster configuration? Why my job is working only with one map task?</p>
  
  <p>----- SOLUTION -----</p>
  
  <p>It was simply a problem of the IP address. I changed localhost by the IP address and it is working fine now.</p>