How To Install MySQL on CentOS 7

How To Install MySQL on CentOS 7
Riddhi Jindal
Riddhi Jindal

Created: 06/04/2020 10:03 AM - Updated: 06/04/2020 10:03 AM

How To Install MySQL on CentOS 7

                                                               
Step 1 — Installing MySQL

In a web browser, visit:

https://dev.mysql.com/downloads/repo/yum/

 

Locate the desired version, and update it as needed in the link below:


  

·         wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
·          
·         md5sum mysql57-community-release-el7-9.noarch.rpm
·          
Output
1a29601dc380ef2c7bc25e2a0e25d31e  mysql57-community-release-el7-9.noarch.rpm

Compare this output with the appropriate MD5 value on the site:




·         sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
·          
·         sudo yum install mysql-server
·          

Step 2 — Starting MySQL

·         sudo systemctl start mysqld
·         sudo systemctl status mysqld
·          

If MySQL has successfully started, the output should contain Active: active (running) 

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

Make note of the password given in the output.

Step 3 — Configuring MySQL

·         sudo mysql_secure_installation
·          

Step 4 — Testing MySQL1

·         mysqladmin -u root -p version
·          

You should see output similar to this:

Output

mysqladmin  Ver 8.42 Distrib 5.7.16, for Linux on x86_64
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Server version          5.7.16
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 2 min 17 sec
 
Threads: 1  Questions: 6  Slow queries: 0  Opens: 107  Flush tables: 1  Open tables: 100  Queries per second avg: 0.043

This indicates your installation has been successful.

Was this article helpful?

0 Out of 0 Marked As Helpfull

Have more questions? Please Contact Us