MySQL Installation on Linux 7 step by step tutorial

MySQL Installation on Linux 7 step by step tutorial | dbatutorial

This article will help one to learn how to Install MySQL on Linux Using the MySQL Yum Repository. The MySQL Yum repository for Oracle Linux, Red Hat Enterprise Linux, CentOS, and Fedora provides RPM packages for installing the MySQL server.

Steps for a Fresh Installation of MySQL as below.

Step 1: Adding the MySQL Yum Repository

i. Go to the Download MySQL Yum Repository page (https://dev.mysql.com/downloads/repo/yum/) in the MySQL Developer Zone.

ii. select and download the release package for your platform.

iii. Install the downloaded release package with the following command, replacing platform-and-version-specific-package-name with the name of the downloaded RPM package.

iv. Upload the downloaded RPM to the server where we are going to install MySQL database. Here, we upload RPM (mysql80-community-release-el7-3.noarch.rpm) to /root directory using filezilla. 

Step 2: Install package using yum

For an EL7-based system 

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

You can check that the MySQL Yum repository has been successfully added by the following command

# yum repolist enabled | grep "mysql.*-community.*"

Step 3: Edit MySQL repository as follow

# vi /etc/yum.repos.d/mysql-community.repo

[mysql57-community]

name=MySQL 5.7 Community Server

baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Enable to use MySQL 8.0

[mysql80-community]

name=MySQL 8.0 Community Server

baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Step 4: Installing MySQL

# yum install mysql-community-server

Step 5: Starting the MySQL Server

# systemctl start mysqld

check the status of the MySQL server with the following command

# systemctl status mysqld

Stop MySQL server command as follow

# systemctl stop mysqld

Step 6: Change the root password as soon as possible by logging

You can know the mysql default password using below command.

[root@node1 etc]# grep 'temporary password' /var/log/mysqld.log

2021-10-14T16:10:06.076501Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: qoHdxlZ>T0sj

[root@node1 etc]# mysql --user=root --password

Change default password using below query.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'New@Mysql123';

Query OK, 0 rows affected (0.05 sec)


Done!

Post a Comment

0 Comments

3