Rate This Document
Findability
Accuracy
Completeness
Readability

Installing MariaDB

Hive stores metadata in the database. Before installing Hive, you need to install the database software and configure database information in hive-site.xml. Common databases include Derby, MySQL, and MariaDB. This document uses MariaDB as an example. The deployment of other databases is similar.

  1. Install MariaDB on server 1.
    1. Install MariaDB.

      Before installing MariaDB, ensure that the Yum source has been configured.

      1
      yum -y install mariadb*
      
    2. Start the MariaDB service.
      1
      systemctl start mariadb.service
      
    3. Optional: Configuring autostart upon power-on.
      1
      systemctl enable mariadb.service
      
  2. Configure the permissions and password.
    1. Log in to the database and press Enter twice. No password is required for the first login.
      1
      mysql -uroot -p
      
    2. Access the MySQL database.
      1
      use mysql;
      
    3. Grant all permissions to the root user and set a password for the root user.
      1
      grant all on *.* to root@'server1' identified by 'xxxxxxxx';
      
      • server1 indicates the name of the host where MySQL is installed.
      • Replace the example password xxxxxxxx with your desired one.
    4. Update the permissions.
      1
      flush privileges;
      
    5. Exit the database.
      1
      quit;
      
  3. Set the UTF-8 character encoding.
    1. Open the mariadb-server.cnf configuration file.
      1
      vi /etc/my.cnf.d/mariadb-server.cnf
      
    2. Press i to enter the insert mode and add the following content to the [mysqld] label:
      1
      2
      3
      4
      5
      init_connect='SET collation_connection = utf8_unicode_ci'
      init_connect='SET NAMES utf8'
      character-set-server=utf8
      collation-server=utf8_unicode_ci
      skip-character-set-client-handshake
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Open the mysql-clients.cnf file.
      1
      vi /etc/my.cnf.d/mysql-clients.cnf
      
    5. Press i to enter the insert mode and add the following content (if the [client] section exists, simply append the parameter):
      1
      2
      [client]
      default-character-set=utf8
      
    6. Press Esc, type :wq!, and press Enter to save the file and exit.
    7. Open the mysql-clients.cnf file.
      1
      vi /etc/my.cnf.d/mysql-clients.cnf
      
    8. Press i to enter the insert mode and add the following content to the [mysql] label:
      1
      default-character-set=utf8
      
    9. Press Esc, type :wq!, and press Enter to save the file and exit.
    10. Restart MariaDB.
      1
      systemctl restart mariadb.service