Install MySQL on Linux using RPM Package

This article is a step by step guide to learn how to install MySQL database server on Linux platform (CentOS) using RPM package. After this tutorial, MySQL database server and tools will be up and running for learning and practicing MySQL commands.

Overview

There are different methods for installing MySQL on Linux. Few options are listed below.

  • Install from a generic binary package in .tar.gz format
  • Extract, compile and install from a source distribution
  • Install using a precompiled RPM package
  • Deploy MySQL Server with Docker

MySQL is available on a number of operating systems and platforms. For information about officially supported platforms please visit MySQL website.

When preparing to install MySQL, decide which version and distribution format (binary or source) to use. Recommendation is to use most recent GA release.

Install MySQL

In this article, we are going to see steps to install MySQL server using RPM package on CentOS.

Download RPM package

  1. Go to https://dev.mysql.com/downloads/mysql/
  2. Click on link ‘Yum Repository’
  3. Choose RPM package and click on ‘Download’ button
  4. In next page, you can Login/Signup before downloading or directly click on ‘No thanks, just start my download.’ to start download.
  5. To download using CLI, copy the link of ‘No thanks, just start my download.’ and run wget command.
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Install RPM package and Start MySQL

The Yum repository provides a simple and convenient way to install and update MySQL products with the latest software packages using Yum.

yum install -y mysql80-community-release-el7-3.noarch.rpm
yum install -y mysql-server

This command will take some time to complete. You will see installation completed message. Start the MySQL server with the following command.

systemctl start mysqld

Validate Installation

Following steps happens in the given order during server start up. This happens only when the data directory of the server is empty.

  • The server is initialized
  • An SSL certificate and key files are generated in the data directory
  • The validate_password plugin is installed and enabled
  • The root account, super user, ‘root’@’localhost’ is created. A password for the superuser is set and stored in log file ‘mysqld.log

Run below command to get password

grep 'temporary password' /var/log/mysqld.log

Once you get the password, you can login to database using below command. On prompt enter password that you have got in previous step

 mysql -u root -p

That’s all. You have setup MySQL server. Thank you for reading. Please let us know your thoughts in comments

Leave a Reply

avatar
  Subscribe  
Notify of