# yum在线安装

> 来源：梦飞idc云平台 | 原文：https://www.mfisp.com/16700.html | 发布：2023-02-15 | 更新：2023-02-15 | 分类：建站教程、投稿分享

1、下载并安装MySQL官方的 Yum Repository

 

[root@node1 ~]# wget -c https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm

 

2、添加 MySQL Yum Repository

 

**[root@node1 ~]# yum localinstall mysql80-community-release-el7-5.noarch.rpm -y**

 

3、选择安装发行版

 

前提: 安装YUM

 

[root@node1 ~]# yum-config-manager --disable mysql80-community #禁用8.0  
[root@node1 ~]# yum-config-manager --enable mysql57-community #启用5.7

 

**验证**

 

**[root@node1 ~]# yum repolist enabled | grep -i ^mysql  
mysql-connectors-community/x86_64 MySQL Connectors Community 230  
mysql-tools-community/x86_64 MySQL Tools Community 138  
mysql57-community/x86_64 MySQL 5.7 Community Server 564**

 

**4、在线安装**

 

**[root@node1 ~]# yum install -y mysql-community-server**

 

5、启动数据库

 

[root@node1 ~]# systemctl enable --now mysqld

 

6、登陆

 

[root@node1 ~]# tmp_pwd=`awk '/temporary password/ {print $NF}' /var/log/mysqld.log`  
[root@node1 ~]# mysql -uroot -p$tmp_pwd  
mysql: [Warning] Using a password on the command line interface can be insecure.  
Welcome to the MySQL monitor. Commands end with ; or \g.  
Your MySQL connection id is 10  
Server version: 5.7.37 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

 

Oracle is a registered trademark of Oracle Corporation and/or its  
affiliates. Other names may be trademarks of their respective  
owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql>

---
本页由 梦飞idc云平台（https://www.mfisp.com）提供。站点导航见 https://www.mfisp.com/llms.txt
