Database Linux Tutorials

How to Install MySQL on CentOS 7/RHEL 7

setup_mysql

Install MySql

first we have to add mysql community repo to our system for that you have to execute following command

wget http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm

guess_linux_mysql_install1

install the repo by following command

rpm -ivh mysql57-community-release-el7-7.noarch.rpm

guess_linux_mysql_install2 guess_linux_mysql_install3

update the repository yum update

guess_linux_mysql_install4 guess_linux_mysql_install5

install the mysql server yum install mysql-server

guess_linux_mysql_install6 guess_linux_mysql_install7 guess_linux_mysql_install8

start mysql server systemctl start mysqld

guess_linux_mysql_install9

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

guess_linux_mysql_install11 guess_linux_mysql_install12

configure mysql server by executing this mysql_secure_installation

guess_linux_mysql_install13 guess_linux_mysql_install14 guess_linux_mysql_install15 guess_linux_mysql_install16 guess_linux_mysql_install17

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

execute mysql -u root -p

guess_linux_mysql_install18 guess_linux_mysql_install19 guess_linux_mysql_install20 guess_linux_mysql_install21

enter your password, you are done.

Thank You.

6 Comments

Leave a Comment