If you are installing Hive and HCatalog or installing Oozie, you must install a database to store metadata information in the metastore. You can either use an existing database instance or install a new instance manually. HDP supports the following databases for the metastore:
Postgres 8.x, 9.x
MySQL 5.x
Oracle 11g r2
SQL Server 2012, 2014
![]() | Note |
|---|---|
By default, Hive uses the Derby database for the metastore. However, Derby is not supported for production systems. |
The following instructions explain how to install MySQL as the metastore. See your third-party documentation for instructions on how to install other supported databases.
To install a new instance of MySQL:
Connect to the host machine you plan to use for Hive and HCatalog.
Install MySQL server. From a terminal window, type:
For RHEL/CentOS:
yum install mysql-server
Start the instance.
/etc/init.d/mysqld start
Set the
rootuser password.mysqladmin -u root -p‘{password}’ password $mysqlpasswordRemove unnecessary information from log and STDOUT.
mysqladmin -u root 2>&1 >/dev/null
As
root,use mysql (or other client tool) to create the “dbuser” and grant it adequate privileges. This user provides access to the Hive metastore.CREATE USER '$dbusername'@'localhost' IDENTIFIED BY '$dbuserpassword'; GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'localhost'; CREATE USER 'dbuser'@'%' IDENTIFIED BY 'dbuserpassword'; GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'%'; FLUSH PRIVILEGES; mysql> GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'localhost' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'%' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)
See if you can connect to the database as that user. You are prompted to enter the
$dbuserpasswordpassword above.mysql -u dbuser -p$dbuserpassword
Install the MySQL connector JAR file.
For RHEL/CentOS/Oracle Linux:
yum install mysql-connector-java*
For SLES:
zypper install mysql-connector-java*

![[Note]](../common/images/admon/note.png)
