Support Questions

Find answers, ask questions, and share your expertise

Access denied for user 'ambari'@localhost (using password: YES)

avatar
Expert Contributor

I'm traying to install Ambari for my cluster HDP, while when I configured MYSQL to be the database for My Serveur Ambari and than Started Ambari Service i got this erreur:

ERROR - Unexpected error, database check failed com.google.inject.CreationException: Guice creation errors: 1) Error injecting constructor, java.lang.RuntimeException: java.sql.SQLException: Access denied for user 'ambari'@'10.166.2.206' (using password: YES) at org.apache.ambari.server.orm.DBAccessorImpl.<init>(DBAccessorImpl.java:83) at org.apache.ambari.server.orm.DBAccessorImpl.class(DBAccessorImpl.java:71) while locating org.apache.ambari.server.orm.DBAccessorImpl while locating org.apache.ambari.server.orm.DBAccessor for field at org.apache.ambari.server.orm.dao.DaoUtils.dbAccessor(DaoUtils.java:36)

Can someone explaine what wrong with My Ambari server Please

1 ACCEPTED SOLUTION

avatar
Expert Contributor

I think that i found the solution:

when i started the ambari installation, I stupidly change the default password which is bigdata to an other

So when the server goes to start it retrieve the password which is inside /etc/ambari-server/conf/password.dat in order to connect to Mysql which is obviously not the same.

I forced the change of the password in the path: /etc/ambari-server/conf/password.dat and then it works fine

thanks @Jay Kumar SenSharma

View solution in original post

15 REPLIES 15

avatar
Master Mentor

@yassine sihi

Thanks for sharing the solution to check the password file first.

[root@sandbox ~]# cat /etc/ambari-server/conf/password.dat
bigdata

avatar
Master Mentor

@yassine sihi

It looks like the GRANT for "ambari' user are not properly set inside the DB.

Can you please share the output of the following SQL query from the Database. You can login as "root" user inside the DB and then run the command;

mysql> select User,Password,Host from mysql.user;

.

Also update the "ambari" suer password using the following command:

mysql>  UPDATE user SET Password=PASSWORD('bigdata') where USER='ambari'; 
mysql>  FLUSH PRIVILEGES;

.

Then restart Ambari Server.

avatar
Expert Contributor

@Jay Kumar SenSharma

Ok, This is the output after running UPDATE query:

42461-ex.jpg

avatar
Master Mentor

@yassine sihi

In the above screenshot the "password" column for user "ambari" is Empty where the Host is "10.166.2.206" which should be set to password.

 UPDATE user SET Password=PASSWORD('bigdata') where USER='ambari';

.

And then the Grant need to be provided to the user.

<br>mysql> use mysql;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost'; 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'s1xxxxxxxxxxxx';    <--- correct hostname
mysql> GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'10.166.2.206'; 
mysql> FLUSH PRIVILEGES;

.

avatar
Expert Contributor

@Jay Kumar SenSharma

I don't think that's the issue because i have already done it.

thanks Jay

avatar
Expert Contributor

I think that i found the solution:

when i started the ambari installation, I stupidly change the default password which is bigdata to an other

So when the server goes to start it retrieve the password which is inside /etc/ambari-server/conf/password.dat in order to connect to Mysql which is obviously not the same.

I forced the change of the password in the path: /etc/ambari-server/conf/password.dat and then it works fine

thanks @Jay Kumar SenSharma