top of page

MySQL 8.0 on CentOS 7

This article demonstrates MySQL installation on Cent OS Linux 7 version.


Installation of MySQL


Install wget to download MySQL repository

yum install wget

Download MySQL

# wget https://repo.mysql.com//mysql80-community-release-el7-5.noarch.rpm

Adding the MySQL Yum Repository

# yum install mysql80-community-release-el7-5.noarch.rpm

Installing MySQL

$ yum install mysql-community-server

Start MySQL service and enable it to auto-start on reboot

# chkconfig mysqld on
# service mysqld start

Start the MySQL server with the following command

# systemctl start mysqld

You can check the status of the MySQL server with the following command:

# systemctl status mysqld

A superuser account 'root'@'localhost' is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command

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

Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:

# mysql -uroot -p

mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';


Create MySQL Database


Use the below command to create a new database

mysql> create database mydb;

List all the databases

mysql> show databases;

To switch between databases use the below command

mysql> exit

You can make new connections directly to the database as follows.

$ mysql --user=root --database=mydb --password
Enter password:

Installation Done!

Related Posts

Heading 2

Add paragraph text. Click “Edit Text” to customize this theme across your site. You can update and reuse text themes.

bottom of page