Configuring MySQL for Ranger
You can use the MySQL root user to create the Ranger databases.
Optionally, you can also create a non-root user to use to create the Ranger databases. For example, you would use the following series of commands to create the
rangerdba
user with passwordrangerdba
.Log in as the root user, then use the following commands to create the
rangerdba
user and grant it adequate privileges.CREATE USER 'rangerdba'@'localhost' IDENTIFIED BY 'rangerdba'; GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'localhost'; CREATE USER 'rangerdba'@'%' IDENTIFIED BY 'rangerdba'; GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'%'; GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'rangerdba'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;
Use the
exit
command to exit MySQL.You should now be able to reconnect to the database as
rangerdba
using the following command:mysql -u rangerdba -prangerdba
After testing the
rangerdba
login, use theexit
command to exit MySQL.
Use the following command to confirm that the
mysql-connector-java.jar
file is in the Java share directory. This command must be run on the server where Ambari server is installed.ls /usr/share/java/mysql-connector-java.jar
If the file is not in the Java share directory, use the following command to install the MySQL connector .jar file.
RHEL/CentOS/Oracle Linux
yum install mysql-connector-java*
SLES
zypper install mysql-connector-java*
Use the following command format to set the
jdbc/driver/path
based on the location of the MySQL JDBC driver .jar file.This command must be run on the server where Ambari server is installed.ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}
For example:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar