Introduction

MySQL is the world’s most popular open-source database. With its proven performance, reliability and ease-of-use. Many of the world’s largest and fastest-growing organizations including Facebook, Google, Adobe, Alcatel Lucent, and Zappos rely on MySQL to save time and money powering their high-volume Web sites, business-critical systems, and packaged software. This post will show you how to install MySQL on CentOS 7 operating system.
(Reference: https://www.mysql.com/)

Installation

Download MySQL package

Go to this site to download the .rpm file installer https://dev.mysql.com/downloads/repo/yum/. Then download the .rpm file with wget command.

[root@server ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

Verify downloaded MySQL package

After .rpm file downloaded, check the integrity of the file with md5sum command and verify the output on the terminal with the website link https://dev.mysql.com/downloads/repo/yum/.

[root@server ~]# md5sum mysql57-community-release-el7-9.noarch.rpm
1a29601dc380ef2c7bc25e2a0e25d31e mysql57-community-release-el7-9.noarch.rpm
[root@server ~]#

Install MySQL package

If the downloaded package is verified, we can add the package to the repository with rpm command.

[root@server ~]# rpm -ivh mysql57-community-release-el7-9.noarch.rpm
warning: mysql57-community-release-el7-9.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql57-community-release-el7-9  ################################# [100%]
[root@server ~]#

Then, install the package with yum command.

[root@server ~]# yum install mysql-server -y
MySQL installation succeed

Start and Configure MySQL

Before we can configure the MySQL password, we must first start the MySQL instance. The following command will start the instance and make MySQL auto-start when server is up.

[root@server ~]# systemctl start mysqld
[root@server ~]# systemctl status mysqld
[root@server ~]# systemctl enable mysqld

MySQL first initiation will generate a random password for root user. Follow this command to retrieve the password and keep it for later.

[root@server ~]# grep 'temporary password' /var/log/mysqld.log
MySQL Temporary Password

Then change the root password and other configuration with mysql_secure_installation command. When asked for the root password put the temporary password that we take before.

MySQL Configuration Process

Test Installed MySQL

After we configure the MySQL instance, test the MySQL with connecting to it. Use mysql command to connect the MySQL use root user and password that we change on the configure step.

[root@server ~]# mysql -u root -p
MySQL Ready to Use

Leave a Reply

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


The maximum upload file size: 64 MB.
You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other.