Using Ambari with MySQL/MariaDB
To set up MySQL or MariaDB for use with Ambari:
Steps
On the Ambari Server host, install the connector.
Install the connector
RHEL/CentOS/Oracle Linux
yum install mysql-connector-java
SLES
zypper install mysql-connector-java
Debian/Ubuntu
apt-get install libmysql-java
Confirm that
.jaris in the Java share directory.ls /usr/share/java/mysql-connector-java.jar
Make sure the .jar file has the appropriate permissions - 644.
Create a user for Ambari and grant it permissions.
For example, using the MySQL database admin utility:
# mysql -u root -p
CREATE USER '<AMBARIUSER>'@'%' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'%';
CREATE USER '<AMBARIUSER>'@'localhost' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'localhost';
CREATE USER '<AMBARIUSER>'@'<AMBARISERVERFQDN>' IDENTIFIED BY '<AMBARIPASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<AMBARIUSER>'@'<AMBARISERVERFQDN>';
FLUSH PRIVILEGES;
Where
<AMBARIUSER>is the Ambari user name,<AMBARIPASSWORD>is the Ambari user password and<AMBARISERVERFQDN>is the Fully Qualified Domain Name of the Ambari Server host.
Load the Ambari Server database schema.
You must pre-load the Ambari database schema into your MySQL database using the schema script. Run the script in the same location where you find the
Ambari-DDL-MySQL-CREATE.sqlfile. You should find theAmbari-DDL-MySQL-CREATE.sqlfile in the/var/lib/ambari-server/resources/directory of the Ambari Server host, after you have installed Ambari Server.mysql -u <AMBARIUSER> -p
CREATE DATABASE <AMBARIDATABASE>;
USE <AMBARIDATABASE>;
SOURCE Ambari-DDL-MySQL-CREATE.sql;
Where
<AMBARIUSER>is the Ambari user name and<AMBARIDATABASE>is the Ambari database name.
When setting up the Ambari Server, select
Advanced Database Configuration > Option [3] MySQL/MariaDBand enter the credentials you defined in Step 2. for user name, password and database name.

