Published January 16, 2018 by

Install MySQL server in Centos/RedHat/Fedora

Enable MySQL YUM repository

For CentOS/RedHat

# rpm -Uvh https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm

For Fedora


# rpm -Uvh https://repo.mysql.com/mysql57-community-release-fc26-10.noarch.rpm

Install MySQL Server


MySQL 8.0

For CentOS, RedHat
# yum --enablerepo=mysql80-community install mysql-community-server
For Fedora
# dnf --enablerepo=mysql80-community install mysql-community-server


MySQL 5.7

For CentOS, RedHat
# yum install mysql-community-server
For Fedora 
dnf install mysql-community-server

At installing time MySQL by default set the root password. Using below command finds the MySQL root password

# grep "A temporary password" /var/log/mysqld.log

Start and Configure MySQL

# systemctl start mysqld.service
# mysql_secure_installation

Connect to MySQL

# mysql -u root -p

Check MySQL version

# mysql -v