skip to Main Content

How To Install MySQL on CentOS 7

How To Install MySQL On CentOS 7

Step 1 — Installing MySQL

As we know, MySQL is an open-source database management system that commonly is installed as part of the popular LEMP ( Nginx, Linux, MySQL/MariaDB, PHP/Python/Perl) stack. It uses relational database and SQL (Structured Query Language) to manage its data.

Centos 7 prefers MariaDB, a fork of MySQL managed by the original MySQL developers and designed for replacing MySQL. If you run yum install mysql on Centos 7, it’s MariaDB that is installed rather than MySQL.

This article will guide you how to intall MySQL version 5.7.x on a Centos 7 server.

Download package by using command below:

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
image.png
sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm

Command above adds new MySQL yum repositories, and we can now use them to install MySQL server

sudo yum install mysql-server

We can start the daemon with the following command:

sudo systemctl start mysqld

To be sure we succeeded, we’ll use the following command:

sudo systemctl status mysqld

If MySQL has successfully started, the output will contain Active: active (running)like screenshot below:

During the installation process, a temporary password is generated for the MySQL root user that locates in the var/log/mysqld.log. You can get with following command:

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

If you don’t get it with command above, please follow this article how to reset MySQL root account password .

Step 2 — Configuring MySQL

MySQL makes us easy by including a security script to change some of the less secure default options like remote login and sample users.

To run security script, please use command below:

sudo mysql_secure_installation
image.png

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top
Search