How to Install MySQL on CentOS.

Introduction

MySQL is an opensource, relational database management system. Its name is the combination of two words that are My + SQL where my is the name of co-founder Michael Widenius's daughter and SQL is the abbreviation of Structured Query Language.

MySQL is widely used as a database system in various well-known companies like Google and Facebook. In this tutorial, we will learn the installation process of MySQL server on CentOS.

Prerequisites

  • CentOS 7
  • Login as an administrator on the terminal.
  • Yum must be configured on the system.

Installation

Installation includes following steps.

1. Install MySQL57-community-release

In order to install MySQL, we have to first download RPM repository of MySQL community release by clicking the link https://dev.mysql.com/downloads/file/?id=470281 or execute the following command.

How to Install MySQL on CentOS

Install the rpm package by using following command.

 How to Install MySQL on CentOS 1

2. Install MySQL server

Execute the following command to install mysql-server.

 How to Install MySQL on CentOS 2

3. MySQL Configuration

Start the MySQL server by executing the following command.

Enable MySQL on startup by executing the following command.

Now if we check the status of the service mysqld then, we will find it active and working properly. Execute the following command to do so.

 How to Install MySQL on CentOS 3
 How to Install MySQL on CentOS 4

Now we get a password which is temporary and autogenerated by system on the first time installation. Since the password is not so easy to remember, hence we need to change this password by running mysql_secure_installation on the terminal.

 How to Install MySQL on CentOS 5 Mysql_secutre_installation also provide various functionality which allow user to configure it properly. Simply enter 'y' in every prompt for the proper configuration.

 How to Install MySQL on CentOS 6  How to Install MySQL on CentOS 7

4. Access MySQL shell

Execute the following command to access MySQL shell on which we can execute MySQL queries.

Enter the password which we have just changed and press Enter. This will take us to the MySQL shell.

 How to Install MySQL on CentOS 8

We can execute query on the MySQL shell, we have executed a query here which is responsible for the creation of a database named as javatpoint. Now if we list the database by executing show databases then we get our database in the list.

 How to Install MySQL on CentOS 9

Hence, we have installed and get started with MySQL on CentOS.


Next TopicInstall MariaDB




Latest Courses