Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

mysql default password first time sandbox login

Solved Go to solution

mysql default password first time sandbox login

New Contributor

Hi I am a newbie to HDP, I downloaded the HDP and run with virtualbox. However, when i tried to access the mysql database for the first time after ssh into the sandbox VM, I encountered the following error:

[root@sandbox-hdp ~]# mysql -uroot

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Originally I thought that maybe mysql does require any password for the first time login, therefore i tried to use "hadoop" as the password as suggested in some of the posts i googled, but again the access was denied:

[root@sandbox-hdp ~]# mysql -uroot -phadoop

mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I have also followed this post https://community.hortonworks.com/questions/86949/error-1045-28000-access-denied-for-user-root.html but the suggested solution was not working for me:

  1. # mysql -u root -p
  2. Enter password: hadoop
  3. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I even tries other means such as

[root@sandbox-hdp ~]# mysql -root -h 0.0.0.0

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I am using the latest HDP sandbox which is version 2.6.5

[root@sandbox-hdp ~]# sandbox-version

== Sandbox Information ==

Platform: hdp-security

Build date: 06-18-2018

Ambari version: 2.6.2.0-155

Hadoop version: Hadoop 2.7.3.2.6.5.0-292

OS: CentOS Linux release 7.5.1804

Any help will be appreciated

1 ACCEPTED SOLUTION

Accepted Solutions

Re: mysql default password first time sandbox login

New Contributor

Many thanks for the suggestions from Eric and Sai, I think there may be something wrong with my mysql root access as Eric's suggestion not working for me either:

[root@sandbox-hdp ~]# mysql -uroot -phadoop -hlocalhost

mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I ended up reset the password using the following approach

systemctl stop mysqld

systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"

systemctl start mysqld

mysql -uroot

Once in the mysql, run:

FLUSH PRVILEGES;

UPDATE PASSWORD FOR root@'localhost'=PASSWORD('hadoop')

FLUSH PRIVILEGES;

QUIT;

Once log out from mysql, clear the environment MYSQLD_OPTS and restart mysql server

systemctl unset-environment MYSQLD_OPTS

systemctl restart mysqld

mysql -uroot -phadoop

10 REPLIES 10

Re: mysql default password first time sandbox login

New Contributor

@Xianshun Chen I tried on my sandbox and this password works for me.

[root@sandbox-hdp ~]# mysql -uroot -phadoop -hlocalhost
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.6.39 MySQL Community Server (GPL)

You can try the following link to reset mysql password.

https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords

Re: mysql default password first time sandbox login

New Contributor

As i agree with Eric it should work or also you can enforce by the below settings using the link and let me know if you need any help on this.

https://saisrinivase.wordpress.com/category/mysql/

Re: mysql default password first time sandbox login

New Contributor

Many thanks for the suggestions from Eric and Sai, I think there may be something wrong with my mysql root access as Eric's suggestion not working for me either:

[root@sandbox-hdp ~]# mysql -uroot -phadoop -hlocalhost

mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I ended up reset the password using the following approach

systemctl stop mysqld

systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"

systemctl start mysqld

mysql -uroot

Once in the mysql, run:

FLUSH PRVILEGES;

UPDATE PASSWORD FOR root@'localhost'=PASSWORD('hadoop')

FLUSH PRIVILEGES;

QUIT;

Once log out from mysql, clear the environment MYSQLD_OPTS and restart mysql server

systemctl unset-environment MYSQLD_OPTS

systemctl restart mysqld

mysql -uroot -phadoop

Re: mysql default password first time sandbox login

Expert Contributor

My solution was a similar:

in command line as a root

 

systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"
systemctl start mysqld
mysql -u root

 

in mysql shell

 

use mysql;
update user set authentication_string=PASSWORD("hadoop") where User='root';
flush privileges;
quit

 

After this change, I got trouble hive and ranger due to connection error to MySQL. Then 

I had to change hive and ranger mysql database root user password from Ambari.

It is ok now.

Re: mysql default password first time sandbox login

New Contributor

My hive services wont start after running these commands.

Re: mysql default password first time sandbox login

New Contributor

Hello @Xianshun Chen, thanks a lot. Your answer helped me. May I ask you how did you found your solution?

Re: mysql default password first time sandbox login

Contributor

mysql -u root -p
hortonworks1

Re: mysql default password first time sandbox login

New Contributor

After mysql root password changed, hive metastore service not works. Before password change it worked. When I start the service i get below error

SQLException : SQL state: 28000
java.sql.SQLException: Access denied for user 'root'@'sandbox-hdp.hortonworks.com' (using password: YES) ErrorCode: 1045
2018-08-30 17:13:22,761 [E] Can't establish db connection.

,

After reset mysql root password , hive metastore and ranger admin not works (before changing MySQL root password the hive service was working). Below error shows

SQLException : SQL state: 28000
java.sql.SQLException: Access denied for user 'root'@'sandbox-hdp.hortonworks.com' (using password: YES) ErrorCode: 1045
2018-08-30 17:13:22,761 [E] Can't establish db connection.

Re: mysql default password first time sandbox login

New Contributor

Hello @Ram B, you need to set your new password in the hive metastore also.

You can make it through Ambari UI: Login to the Ambari Dashboard --> click on hive --> Configs --> then Advanced -->under Hive Metastore section --> change the password (your root new password) --> then restart All. Now hive should be working with no problems.

Don't have an account?
Coming from Hortonworks? Activate your account here