Support Questions

Find answers, ask questions, and share your expertise

Ambari cant make mysql DB connection

avatar
Super Collaborator

now that I have resolved the wget proxy issues , I am continuing installing with public HDP repositories but now I am having issues connecting to the hive user in MySQL . I can connect to this user fine on command prompt please see below.

stderr:  
2017-06-20 14:12:11,925 - Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties.
java.sql.SQLException: Access denied for user 'hive'@'hadoop2.tolls.dot.state.fl.us' (using password: YES)

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 531, in <module>
    CheckHost().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 329, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 206, in actionexecute
    raise Fail(error_message)
resource_management.core.exceptions.Fail: Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties.
java.sql.SQLException: Access denied for user 'hive'@'hadoop2.tolls.dot.state.fl.us' (using password: YES)stdout:  
2017-06-20 14:12:11,568 - Host checks started.
2017-06-20 14:12:11,568 - Check execute list: db_connection_check
2017-06-20 14:12:11,568 - DB connection check started.
WARNING: File /var/lib/ambari-agent/cache/DBConnectionVerification.jar already exists, assuming it was downloaded before
WARNING: File /var/lib/ambari-agent/cache/mysql-connector-java.jar already exists, assuming it was downloaded before
2017-06-20 14:12:11,569 - call['/usr/jdk64/jdk1.8.0_112/bin/java -cp /var/lib/ambari-agent/cache/DBConnectionVerification.jar:/var/lib/ambari-agent/cache/mysql-connector-java.jar -Djava.library.path=/var/lib/ambari-agent/cache org.apache.ambari.server.DBConnectionVerification "jdbc:mysql://hadoop2.tolls.dot.state.fl.us/hive" "hive" [PROTECTED] com.mysql.jdbc.Driver'] {}
2017-06-20 14:12:11,924 - call returned (1, "ERROR: Unable to connect to the DB. Please check DB connection properties.\njava.sql.SQLException: Access denied for user 'hive'@'hadoop2.tolls.dot.state.fl.us' (using password: YES)")
2017-06-20 14:12:11,924 - DB connection check completed.
2017-06-20 14:12:11,925 - Host checks completed.
2017-06-20 14:12:11,925 - Check db_connection_check was unsuccessful. Exit code: 1. Message: ERROR: Unable to connect to the DB. Please check DB connection properties.
java.sql.SQLException: Access denied for user 'hive'@'hadoop2.tolls.dot.state.fl.us' (using password: YES)

Command failed after 1 tries
[root@hadoop2 ~]# mysql -u hive -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hive               |
| mysql              |
| oozie              |
| ranger             |
| ranger_audit       |
+--------------------+
6 rows in set (0.00 sec)


Database changed
mysql> select user,host from user;
+-------------+-------------------------------+
| user        | host                          |
+-------------+-------------------------------+
| hive        | %                             |
| oozie       | %                             |
| rangeradmin | %                             |
| rangerdba   | %                             |
| root        | 127.0.0.1                     |
| root        | hadoop2                       |
| hive        | hadoop2.tolls.dot.state.fl.us |
| oozie       | hadoop2.tolls.dot.state.fl.us |
| root        | hadoop2.tolls.dot.state.fl.us |
| hive        | localhost                     |
| oozie       | localhost                     |
| rangeradmin | localhost                     |
| rangerdba   | localhost                     |
| root        | localhost                     |
+-------------+-------------------------------+
14 rows in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'hadoop2.tolls.dot.state.fl.us';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges
    -> ;
Query OK, 0 rows affected (0.00 sec)

1 ACCEPTED SOLUTION

avatar
Super Collaborator

this I found on here .. it fixed the issue

mysql> grant all privileges on *.* to 'hive'@'hadoop2.tolls.dot.state.fl.us' identified by 'hive';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit

View solution in original post

1 REPLY 1

avatar
Super Collaborator

this I found on here .. it fixed the issue

mysql> grant all privileges on *.* to 'hive'@'hadoop2.tolls.dot.state.fl.us' identified by 'hive';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit