0
votes

I am using sqoop 1.4.6 . I am getting error while executing below command for sqoop import :

sqoop import --connect jdbc:mysql://localhost/movielens --driver com.mysql.jdbc.Driver --table movies -m 1

ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)

So I tried below command, but still getting some error:

sqoop import --connect jdbc:mysql://localhost/movielens --username root --password pass --driver com.mysql.jdbc.Driver --table movies -m 1

Error reading primary key metadata: java.sql.SQLSyntaxErrorException: Unknown table 'movies' in information_schema
java.sql.SQLSyntaxErrorException: Unknown table 'movies' in information_schema
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:536)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)
    at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1983)

But when I checked in information_schema, I found movies table in it.

mysql> select table_name from information_schema.tables where table_name like 'movies'; +------------+ | table_name | +------------+ | movies | +------------+ 1 row in set (0.03 sec)

I have also done GRANT privileges on root user. GRANT ALL PRIVILEGES ON movielens.* to ''@'localhost';

What am I missing here?

1
Can I know the reason for downvote? - Arpan Parikh

1 Answers

2
votes
  1. You haven't mentioned "--target-dir" command. Without that, it doesn't work.
  2. More or less, you should also mention port number.
  3. When you are working with Sqoop, make sure you have mysql-connector-java-5.1.45.tar.gz in "/var/lib/sqoop/"

If you are working on Cloudera Cluster, the code looks like,

sqoop import --connect "jdbc:mysql://quickstart.cloudera:3306/<database_name> --table <table_name> --direct -m 1 --target-dir <target_location>

This is the link which guides you on how to install JDBC driver, in case you don't know.