Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

What is the MySQL root-password from Hive-Install?

avatar
Explorer

Hello,

for this fix I need root access to the mysql-instance on the node where Hive is running.
But I noticed, that I set it nowhere during the installation-process?! Not during ambari-installation and not during the HDP-installation. I just set the Hive-DB-password (!= root-password).
When I try to execute the suggested command in the SO-question above (mysql -u root -p -hlocalhost) the Hive-password doesn't work. Also the default password 'admin' doesn't work.

So, is there a trick, whats the password? Or did I do a mistake? I'd like to have full access and control over my cluster and the included components ;D

Thanks,
Warius

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Warius Unnlauf

Without entering any password when it prompts for "Enter Password:" just press ENTER key

Example:

[root@blueprint2 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.6.37 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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              |
| performance_schema |
+--------------------+
4 rows in set (0.02 sec)

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@Warius Unnlauf

Without entering any password when it prompts for "Enter Password:" just press ENTER key

Example:

[root@blueprint2 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.6.37 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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              |
| performance_schema |
+--------------------+
4 rows in set (0.02 sec)

.

avatar
Master Mentor

@Warius Unnlauf

After login in to the DB just in case you want to change the "root" user password then you might want to run:

mysql>  UPDATE user SET Password=PASSWORD('what_ever_you_want') where USER='root'; 

.

avatar
Explorer

Oh, sorry, forgot to mention, I also tried this, and the same error as on the other attempts appears:

[usr@HOST ~]$ mysql -u root -p -hlocalhost
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

avatar
Master Mentor

@Warius Unnlauf


Please do not specify the "-hlocalhost" (Or try using the actual hostname instead of "localhost')

Please run the mysql command from the host where the hive (mysql DB) is installed.

[root@blueprint2 ~]# mysql -u root -p
Enter password: <Just Press Enter Key empty password>

.

Else you will have to gran the *.* privilege to the 'root'@'localhost'

Please try this:

Step1). Edit the following file "/etc/my.cnf" and then set the "skip-grant-tables" as following:

[mysqld]
skip-grant-tables
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
.
.
<br>

2. Restart the mysql.

# service mysqld restar

3. Now login to mysql:

[root@blueprint2 ~]# mysql -urootmysql 

4. Now reset the password.

mysql> UPDATE user SET Password=PASSWORD('redhat') where USER='root'; 
Query OK, 7 rows affected (0.02 sec)
Rows matched: 7  Changed: 7  Warnings: 0

mysql> FLUSH PRIVILEGES; 
Query OK, 0 rows affected (0.00 sec)<strong></strong>

.

.

avatar
Master Mentor

@Warius Unnlauf

mysql> SELECT User, Host, Password FROM mysql.user;
+------+------------+-------------------------------------------+
| User | Host       | Password                                  |
+------+------------+-------------------------------------------+
| root | localhost  |                                           |
| root | blueprint2 |                                           |
| root | 127.0.0.1  |                                           |
| root | ::1        |                                           |
| hive | %          | *4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC |
+------+------------+-------------------------------------------+

Reference: https://www.rosehosting.com/blog/mysql-show-users/