How To Install MySQL on CentOS 8

How To Install MySQL on CentOS 8
Riddhi Jindal
Riddhi Jindal

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

How To Install MySQL on CentOS 8

Step 1 — Installing MySQL

·         sudo dnf install mysql-server
·         sudo systemctl start mysqld.service
·         sudo systemctl status mysqld

Output should contain Active: active (running) and Status: "Server is operational" to check that it is successful.

·         sudo systemctl enable mysqld

Step 2 — Securing MySQL

·         sudo mysql_secure_installation

Step 3 — Testing MySQL

·         mysqladmin -u root -p version

Output :


mysqladmin  Ver 8.0.17 for Linux on x86_64 (Source distribution)
Copyright (c) 2000, 2019, 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
Server version      8.0.17
Protocol version    10
Connection      Localhost via UNIX socket
UNIX socket     /var/lib/mysql/mysql.sock
Uptime:         2 hours 52 min 37 sec
Threads: 2  Questions: 20  Slow queries: 0  Opens: 131  Flush tables: 3  Open tables: 48  Queries per second avg: 0.001

This indicates your installation was successful.

If you want to connect to MySQL and start adding data to it, run the following:

·         mysql -u root -p

Was this article helpful?

0 Out of 0 Marked As Helpfull

Have more questions? Please Contact Us