Configuring MySQL

Install MySQL

Download and add the repository, then update.

sudo yum install wget -y
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum update -y

Install MySQL as usual and start the service. During installation, you will be asked if you want to accept the results from the rpm file’s GPG verification. If no error or mismatch occurs, enter y.

sudo yum install mysql-server -y

Start the mysql Daemon

sudo systemctl start mysqld

Ensure that daemon stays active even after reboot

sudo systemctl enable mysqld

Installing mySQL JDBC driver

sudo yum install mysql-connector-java -y

Configure the External Database

  1. Run the Script

Service

Database

User

Cloudera Manager Server

scm

scmuser

Activity Monitor

amon

amonuser

Reports Manager

rman

rmanuser

Hue

hue

hueuser

Hive Metastore Server

metastore

hiveuser

Oozie

oozie

oozieuser

Data Analytics Studio

das

dasuser

Ranger

ranger

rangeradmin

vi mysql-setup.sql

CREATE DATABASE scm DEFAULT CHARACTER SET utf8;
GRANT ALL on scm.* TO 'scmuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8;
GRANT ALL on metastore.* TO 'hiveuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE amon DEFAULT CHARACTER SET utf8;
GRANT ALL on amon.* TO 'amonuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE rman DEFAULT CHARACTER SET utf8;
GRANT ALL on rman.* TO 'rmanuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE hue DEFAULT CHARACTER SET utf8;
GRANT ALL on hue.* TO 'hueuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8;
GRANT ALL on oozie.* TO 'oozieuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE das DEFAULT CHARACTER SET utf8;
GRANT ALL on das.* TO 'dasuser'@'%' IDENTIFIED BY 'password';
CREATE DATABASE ranger DEFAULT CHARACTER SET utf8;
GRANT ALL on ranger.* TO 'rangeradmin'@'%' IDENTIFIED BY 'password';
mysql -u root < mysql-setup.sql
sudo /usr/bin/mysql_secure_installation

Set Password: password

Note: There is no current password for root in mysql so simply press Enter without entering password

  1. Open mysql Shell

mysql -u root -p

Enter the password: “password”

mysql > show databases;

To exit the Shell

mysql > exit;

Last updated