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.
Install the rpm package by using following command.
2. Install MySQL server
Execute the following command to install mysql-server.
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.
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.
Mysql_secutre_installation also provide various functionality which allow user to configure it properly. Simply enter ‘y’ in every prompt for the proper configuration.
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.
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 tutoraspire. Now if we list the database by executing show databases then we get our database in the list.
Hence, we have installed and get started with MySQL on CentOS.