Support Questions

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

mysql root login password


I am using sandbox image HDF_3.0.2.0_virtualbox_28_11_2017.ova. I am trying to enable hive and start hive metadata database using mysql. I can't create database/user because I can't login in as root. I have tried empty password, hadoop, admin, hive, root, etc. Keep getting the same ERROR 1045 ( 28000): Access denied for user 'root'@'localhost'. Please let me know how I should proceed. Thanks


Master Mentor

@Long M

After you run the "mysql -u root -p" command when it asks for password please enter "hadoop" as password.


# mysql -u root -p
Enter password: hadoop

- Operating System password and MySQL passwords can be different.

But if you have changed mysql root password then you might want to look at the following link which talks about If you assigned arootpassword previously but have forgotten it, you can assign a new password.

Master Mentor

@Long M

Please check your MySQL version. If it is 5.7 or above then A temporary password is generated. Which can be found inside it's log:

# sudo grep "temporary password" /var/log/mysqld.log


Please see:

Master Mentor

@Long M

For more detailed answer on "skip-grant-tables" and resetting root password for mysql please refer to:

New Contributor

I tried 'hadoop' password -> not working

I tried sudo grep "temporary password" /var/log/mysqld.log -> not working

I tried and I ended up with -> not working

Why on a sandbox I need a CIA/FBI hidden password for mysql ?! is it so important ?


New Contributor

Ok after spending 1/2 day here what I did :

1- Find Ambaris password location :

	shell> grep "password" /etc/ambari-server/conf/

2- The output from previous command:


3- Cat password.dat

[root@sandbox-hdp conf]# cat /etc/ambari-server/conf/password.dat //output is 'bigdata' from this command

4- Enter Ambaris postgreSQL db

bigdata[root@sandbox-hdp psql -U ambari
Password for user ambari:
psql (9.2.23)
Type "help" for help.

5- Execute the select:

Expanded display is on.
ambari=> select config_id,type_name,config_data from clusterconfig where type_name='hive-site' ORDER BY config_id DESC LIMIT 1;

6- From the output search for:


Rising Star

hortonworks1 --> This is the pwd


Thank you. It works

New Contributor

@adelin ghanayem

here you can find all the steps to change the root password:

1. Stop mysql:
systemctl stop mysqld

2.Set the mySQL environment option 
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"3.Start mysql usig the options you just set
systemctl start mysqld

4. Login as root
mysql -u root

5.Update the root user password with these mysql commands
mysql>UPDATE mysql.userSET authentication_string = PASSWORD('MyNewPassword')->WHEREUser='root'AND Host ='localhost';
mysql> quit

*** Edit ***As mentioned my shokulei in the comments,for5.7.6and later, you should use 
   mysql>ALTERUSER'root'@'localhost' IDENTIFIED BY'MyNewPass';Or you'll get a warning

6. Stop mysql
systemctl stop mysqld

7. Unset the mySQL envitroment option so it starts normally next time
systemctl unset-environment MYSQLD_OPTS

8.Start mysql normally:
systemctl start mysqld

Try to login using your new password:7. mysql -u root -p

see more info at