Support Questions

Find answers, ask questions, and share your expertise

Ranger: Access denied for user 'rangeradmin'@'localhost'

avatar

I followed the instructions (https://cwiki.apache.org/confluence/display/RANGER/Ranger+Installation+Guide) to install Ranger admin and usersync for evaluation. Ranger admin UI is up.

Also followed the instructions at https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.1/bk_security/content/configuring_mysql_for_r... to setup MySQL server and create/grant permissions to necessary users. MySQL is running on the same machine as Ranger admin and usersync.

Granted the same permissions to user rangeradmin as well.

However, I see a flurry of following errors in /usr/local/mysql/data/mysqld.local.err:

2017-07-27T05:50:37.759668Z 1389 [Note] Access denied for user 'rangeradmin'@'localhost' (using password: YES)

2017-07-27T05:50:37.759669Z 1390 [Note] Access denied for user 'rangeradmin'@'localhost' (using password: YES)

2017-07-27T05:50:38.762447Z 1392 [Note] Access denied for user 'rangeradmin'@'localhost' (using password: YES)

[...]

I am able to connect to MySQL as 'rangeradmin' using MySQL's command line client. Not sure why Ranger admin is not able to connect.

Also, I am _not_ able to login to Ranger admin UI. It displays "Unable to connect to DB..." error. Any pointers to debug?

Thanks.

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Ameya Sakhalkar

Don't worry you can create a new Ranger database as follow change username and password to suit your environment.

mysql -u root -p{rootpassword}

CREATE USER 'ranger'@'localhost' IDENTIFIED BY 'ranger_password';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'rangerDBhost';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'rangerDBhost' IDENTIFIED BY 'ranger' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'localhost' IDENTIFIED BY 'ranger_password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'ranger'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
# mysql -u ranger -pranger
CREATE DATABASE ranger;

################ simpler version ###################
create database ranger;
create user ranger identified by 'ranger';
grant all on ranger.* to ranger;
Flush privileges;

Let me know if that helps

View solution in original post

10 REPLIES 10

avatar

Thanks a ton @Geoffrey Shelton Okot. It worked.