first we have to add mysql community repo to our system for that you have to execute following command
install the repo by following command
rpm -ivh mysql57-community-release-el7-7.noarch.rpm
update the repository
install the mysql server
yum install mysql-server
start mysql server
systemctl start mysqld
MySQL v 5.7 or higher generates a temporary random password after installation and stored that in mysql error log file, located at /var/log/mysqld.log
for an installation by the MySQL Yum repository on CentOS 7.
use below command to see the password:
grep 'temporary password' /var/log/mysqld.log
configure mysql server by executing this
Change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options.
Test MySql Server
mysql -u root -p
enter your password, you are done.