Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

SQOOP- unable tio connect to mysql or Hive2 server

avatar

Hi,

I am learning sqoop using the sandbox and blocked on the first step concerning connection to the database server.

I ssh the VM with git bash

I have tested 2 cases : mysql and hive

For the first case , I type the command "mysql -u root" and it returns "access denied" as you can see on the picture in the red rectangle

For the second case, I tried to connect to Hive server - database "default". I used the jdbc url i have seen on ambari /Hive service as you can see on picture ambariHive

Does anyone can help me troubleshooting this problem?

Thanks

ambarihive.pngsqoopproblem.png

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Oriane

In Sandbox the default mysql password will be "hadoop" So please try this:

# mysql -u root -p
Enter password: hadoop

.

Then once you are inside the mysql prompt you can run the following kind of queries:

mysql> use mysql
mysql> show tables;
mysql> select * from help_keyword;

. Then from Sqoop try the following:

# sqoop list-databases --connect "jdbc:mysql://localhost:3306" --username root --password hadoop

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Oriane

There are two issues in your attached screen shots:

1. "access denied" you should use the "-p" option while connecting to mysql as following:

mysql -u root -p

If it still does not work then Try the following: Reset the root password:

mysqladmin -u root password newPassword

Then try to connect to mysql as following:

mysql -u root -p

2. Regarding the Sqoop connection string, I see that there are extra "//" sybmol in the connection string.

jdbc://hive2://sandbox.hortonworks.com:2181/default

Should be following i guess:

jdbc:hive2://sandbox.hortonworks.com:2181/default

- You might want to try the SQOOP command as following:

sqoop list-databases --connect "jdbc:mysql://localhost:3306" --username root --password newPassword

OR

sqoop list-tables --connect "jdbc:mysql://localhost:3306/testDB" --username root --password ewPassword

avatar

Hi @Jay . Thanks for your response. You are right concerning hive so i remove the extra "//" as you see on the pic but I face a problem of "parsing arguments"

Concerning the command "msql -u root -p, i always face the problem of access denied

Thanks for your feedbacksqoopproblem1.png

avatar
Master Mentor

@Oriane

Can you check if your "mysql" is listening to which host? (localhost or any specific hostname)? Mysql should by default open 3306 port.

nstatst -tnlpa | grep 3306

try restarting mysql

service mysqld restart

.

Also try to enclose the --connection string inside Double Quotation mark. As mentioned in my previous example.

avatar
Master Mentor

@Oriane

In Sandbox the default mysql password will be "hadoop" So please try this:

# mysql -u root -p
Enter password: hadoop

.

Then once you are inside the mysql prompt you can run the following kind of queries:

mysql> use mysql
mysql> show tables;
mysql> select * from help_keyword;

. Then from Sqoop try the following:

# sqoop list-databases --connect "jdbc:mysql://localhost:3306" --username root --password hadoop

.

avatar

Thanks @jay! I am able to list the tables using mysql database server and its databases and also tables in each data base.