How to install mysql via yum on centos7

How to install mysql via yum on centos7

1. Check whether MySQL is installed

yum list installed | grep mysql

If so, uninstall them all

yum -y remove +數據庫名稱

2.MySQL depends on libaio, so you need to install libaio first

yum search libaio # Retrieve relevant information yum install libaio # Install dependent packages

3. Download MySQL Yum Repository

If you can't find the wget command, first yum install wget

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

4. Add MySQL Yum Repository

Add the MySQL Yum Repository to your system repository list by running

yum localinstall mysql-community-release-el7-5.noarch.rpm

5. Verify whether the addition is successful

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

6. Select the MySQL version to enable

Check the MySQL version and execute

yum repolist all | grep mysql

You can see that versions 5.5 and 5.7 are disabled by default, because the latest stable version is 5.6.

yum repolist enabled | grep mysql

View the currently started MySQL version

7. Install MySQL via Yum

yum install mysql-community-server

Yum will automatically handle the dependencies between MySQL and other components

At this point, the MySQL installation is complete. It includes four packages: mysql-community-server, mysql-community-client, mysql-community-common, and mysql-community-libs.

8. Execution

rpm -qi mysql-community-server.x86_64 0:5.6.24-3.el7

If you are prompted that it cannot be found, follow the version you installed and execute step 7 to see the installed version.

implement

You can see that the installation directory of MySQL is /usr/bin/

Starting and Shutting Down MySQL Server

Start MySQL Server

systemctl start mysqld

Check MySQL Server Status

systemctl status mysqld

Shutdown MySQL Server

systemctl stop mysqld

Test whether the installation is successful

mysql

You can enter the mysql command line interface

Firewall settings (can be turned off directly)

To access MySQL remotely, you need to open the default port number 3306.

implement

firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=3306/udp
firewall-cmd --reload 
---------------------

Summarize

The above is the method that the editor introduced to you to install MySQL on centos7 through yum. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time!

You may also be interested in:
  • Detailed steps to install MySQL 5.7 via YUM on CentOS7
  • CentOS 6-7 yum installation method of PHP (recommended)
  • Tutorial on installing PHP on centos via yum
  • Tutorial on installing rabbitmq using yum on centos8
  • How to install mongodb 4.2 using yum on centos8
  • Detailed explanation of configuring Docker's yum source and installing it in CentOS7
  • Detailed tutorial on how to install PHP7.2 in Centos7 Yum
  • How to install rabbitmq-server using yum on centos

<<:  Detailed explanation of using Docker to quickly deploy the ELK environment (latest version 5.5.1)

>>:  Ant designing vue table to achieve a complete example of scalable columns

Recommend

MySQL 5.7.21 Installer Installation Graphic Tutorial under Windows 10

Install MySQL and keep a note. I don’t know if it...

In-depth understanding of MySQL slow query log

Table of contents What is the slow query log? How...

Use and understanding of MySQL triggers

Table of contents 1. What is a trigger? 2. Create...

Install and build a server environment of PHP+Apache+MySQL on CentOS

Yum (full name Yellow dog Updater, Modified) is a...

How does Zabbix monitor and obtain network device data through ssh?

Scenario simulation: The operation and maintenanc...

MySQL Server 8.0.3 Installation and Configuration Methods Graphic Tutorial

This document records the installation and config...

MySQL data compression performance comparison details

Table of contents 1. Test environment 1.1 Hardwar...

Use CSS variables to achieve cool and amazing floating effects

Recently, I found a fun hover animation from the ...

Detailed explanation of how to use the vue verification code component

This article example shares the specific implemen...

How to ensure the overall user experience

Related Articles: Website Design for User Experien...

Detailed explanation of MySQL transactions and MySQL logs

Transactional Characteristics 1. Atomicity: After...

Vue uses echarts to draw an organizational chart

Yesterday, I wrote a blog about the circular prog...