Support Questions

Find answers, ask questions, and share your expertise

Sqoop import from mysql : Access denied for user 'root'@'worker01'

avatar
Expert Contributor

Hello everyone!

 

I've MySQL server running on the master node (10.0.0.4) with user root which I gave all privileges.

MySQL connection through sqoop works correctly on the master with the following command:

 

sqoop list-tables \
--driver com.mysql.jdbc.Driver \
--connect jdbc:mysql://10.0.0.4/employees \
--username root --password $pwd

 

When I launch sqoop job to import a table from MySQL, I got the following error:

 

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

It's like the worker try to access to the mysql db with its hostname, instead of the hostname of the master where I started the job. The sqoop command is the following:

 

sqoop import \
--driver com.mysql.jdbc.Driver \
--connect jdbc:mysql://10.0.0.4/employees \
--username root --password $pwd \
--table titles \
--split-by emp_no \
--warehouse-dir /user/cloudera/sqoop

Does anyone know how to solve this issue?

 

 

 

 

 

 

3 REPLIES 3

avatar
Champion

@ludof

 

The table 'titles' will be in hdfs, so the user root cannot access it unless it has permission to read/write (root is not an admin for hdfs). Either you can set the permission to the root user in hdfs for the table or use the user who has already permission to read/write

avatar
Expert Contributor

Thank you, I've solved creating a new user in MySQL which had also write permissions on HDFS.

avatar
Explorer

I am facing same problem, MySQL server is in remote location, they have created user, but I can not access with same user from hadoop cluster, how to solve this?