Install MySQL community edition

Linux Version: Oracle Linux 6.8
MySQL Version: 5.7 community edition

This is practice is to install MySQL for some other Spark practices. I have a separate database server that runs Oracle Linux 6.8. And on the server I have Oracle database 12c installed for Hive meta store.

To install MySQL community edition, first get the YUM repository from here: https://dev.mysql.com/downloads/repo/yum/. Since we have OL6.8. The loaded file will be mysql57-community-release-el6-9.noarch.rpm. Once downloaded, run yum localinstall as following. And respond with Y when prompted so that the RPM can be installed.

sudo yum localinstall mysql57-community-release-el6-9.noarch.rpm

That should add MySQL Yum repository to your system’s repository list. To verify, you should find following file in /etc/yum.repos.d folder.

/etc/yum.repos.d/mysql-community.repo

In addition, you can use yum repolist command.

With MySQL repository configured, to install MySQL Server, use yum install. When prompted, select Y.

sudo yum install mysql-community-server

When completed, start MySQL using the service command. Note on OL7, it will ask you to use /bin/systemctl command. The service command can also check status. The last command in below gets the default root password, which will be used to reset root password in next step.

sudo service mysqld start
sudo service mysqld status
sudo grep 'temporary password' /var/log/mysqld.log

Next, login to MySQL and change root password. The first time login, you will use the temporary password obtained from prior step.

[oracle@dp2400 ~]$ mysql -uroot -p
mysql> ALTER USER root@localhost IDENTIFIED BY 'a strong password'