# 下载yum源(curl是系统自带的) # curl https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm > centos7.mysql.rpm [root@localhost dnt] curl https: //repo .mysql.com //mysql80-community-release-el7-3 .noarch.rpm > centos7.mysql.rpm ?? % Total??? % Received % Xferd? Average Speed?? Time??? Time???? Time? Current ????????????????????????????????? Dload? Upload?? Total?? Spent??? Left? Speed 100 26024? 100 26024??? 0???? 0? 38150????? 0 --:--:-- --:--:-- --:--:-- 38158 [root@localhost dnt] # ls centos7.mysql.rpm # 安装MySQL的yum源 # yum install centos7.mysql.rpm -y [root@localhost dnt] yum? install ?centos7.mysql.rpm -y 已加载插件:fastestmirror 正在检查 centos7.mysql.rpm: mysql80-community-release-el7-3.noarch centos7.mysql.rpm 将被安装 正在解决依赖关系 --> 正在检查事务 ---> 软件包 mysql80-community-release.noarch.0.el7-3 将被 安装 --> 解决依赖关系完成 依赖关系解决 ========================================================================================================== ? Package??????????????????????????????? 架构??????????????? 版本???????????????? 源?????????????????????????? 大小 ========================================================================================================== 正在安装: ? mysql80-community-release????????????? noarch????????????? el7-3???????????????? /centos7 .mysql?????????????? 31 k 事务概要 ========================================================================================================== 安装? 1 软件包 总计:31 k 安装大小:31 k Downloading packages: Running transaction check Running transaction? test Transaction? test ?succeeded Running transaction ?? 正在安装??? : mysql80-community-release-el7-3.noarch???????????????????????????????????????????????????????? 1 /1 ?? 验证中????? : mysql80-community-release-el7-3.noarch???????????????????????????????????????????????????????? 1 /1 已安装: ?? mysql80-community-release.noarch 0:el7-3 完毕! # 安装MySQL8.0 # yum install mysql-community-server -y [root@localhost dnt] yum? install ?mysql-community-server -y 已加载插件:fastestmirror Loading mirror speeds from cached hostfile ? * base: mirrors.aliyun.com ? * extras: mirrors.cn99.com ? * updates: mirrors.aliyun.com base??????????????????????????????????????????????????????????????????????????????????????? | 3.6 kB? 00:00:00 extras????????????????????????????????????????????????????????????????????????????????????? | 3.4 kB? 00:00:00 mysql-connectors-community????????????????????????????????????????????????????????????????? | 2.5 kB? 00:00:00 mysql-tools-community?????????????????????????????????????????????????????????????????????? | 2.5 kB? 00:00:00 mysql80-community?????????????????????????????????????????????????????????????????????????? | 2.5 kB? 00:00:00 updates???????????????????????????????????????????????????????????????????????????????????? | 3.4 kB? 00:00:00 (1 /3 ): mysql-connectors-community /x86_64/primary_db ?????????????????????????????????????????|? 41 kB? 00:00:00 (2 /3 ): mysql80-community /x86_64/primary_db ??????????????????????????????????????????????????|? 70 kB? 00:00:00 (3 /3 ): mysql-tools-community /x86_64/primary_db ??????????????????????????????????????????????|? 58 kB? 00:00:00 正在解决依赖关系 --> 正在检查事务 ---> 软件包 mysql-community-server.x86_64.0.8.0.16-2.el7 将被 安装 --> 正在处理依赖关系 mysql-community-common(x86-64) = 8.0.16-2.el7,它被软件包 mysql-community-server-8.0.16-2.el7.x86_64 需要 --> 正在处理依赖关系 mysql-community-client(x86-64) >= 8.0.11,它被软件包 mysql-community-server-8.0.16-2.el7.x86_64 需要 --> 正在处理依赖关系 net-tools,它被软件包 mysql-community-server-8.0.16-2.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 mysql-community-client.x86_64.0.8.0.16-2.el7 将被 安装 --> 正在处理依赖关系 mysql-community-libs(x86-64) >= 8.0.11,它被软件包 mysql-community-client-8.0.16-2.el7.x86_64 需要 ---> 软件包 mysql-community-common.x86_64.0.8.0.16-2.el7 将被 安装 ---> 软件包 net-tools.x86_64.0.2.0-0.24.20131004git.el7 将被 安装 --> 正在检查事务 ---> 软件包 mariadb-libs.x86_64.1.5.5.60-1.el7_5 将被 取代 --> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-7.el7.x86_64 需要 --> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-7.el7.x86_64 需要 ---> 软件包 mysql-community-libs.x86_64.0.8.0.16-2.el7 将被 舍弃 --> 正在检查事务 ---> 软件包 mysql-community-libs-compat.x86_64.0.8.0.16-2.el7 将被 舍弃 --> 解决依赖关系完成 依赖关系解决 ========================================================================================================== ? Package??????????????????????????? 架构????????? 版本????????????????????????????? 源??????????????????????? 大小 ========================================================================================================== 正在安装: ? mysql-community-libs?????????????? x86_64??????? 8.0.16-2.el7????????????????????? mysql80-community??????? 3.0 M ?????? 替换? mariadb-libs.x86_64 1:5.5.60-1.el7_5 ? mysql-community-libs-compat??????? x86_64??????? 8.0.16-2.el7????????????????????? mysql80-community??????? 2.1 M ?????? 替换? mariadb-libs.x86_64 1:5.5.60-1.el7_5 ? mysql-community-server???????????? x86_64??????? 8.0.16-2.el7????????????????????? mysql80-community??????? 403 M 为依赖而安装: ? mysql-community-client???????????? x86_64??????? 8.0.16-2.el7????????????????????? mysql80-community???????? 32 M ? mysql-community-common???????????? x86_64??????? 8.0.16-2.el7????????????????????? mysql80-community??????? 575 k ? net-tools????????????????????????? x86_64??????? 2.0-0.24.20131004git.el7????????? base???????????????????? 306 k 事务概要 ========================================================================================================== 安装? 3 软件包 (+3 依赖软件包) 总下载量:441 M Downloading packages: 警告: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-common-8 .0.16-2.el7.x86_64.rpm: 头V3 DSA /SHA1 ?Signature, 密钥 ID 5072e1f5: NOKEY mysql-community-common-8.0.16-2.el7.x86_64.rpm 的公钥尚未安装 (1 /6 ): mysql-community-common-8.0.16-2.el7.x86_64.rpm?????????????????????????????????????? | 575 kB? 00:00:00 (2 /6 ): mysql-community-libs-8.0.16-2.el7.x86_64.rpm???????????????????????????????????????? | 3.0 MB? 00:00:00 (3 /6 ): mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm????????????????????????????????? | 2.1 MB? 00:00:00 (4 /6 ): net-tools-2.0-0.24.20131004git.el7.x86_64.rpm??????????????????????????????????????? | 306 kB? 00:00:00 (5 /6 ): mysql-community-client-8.0.16-2.el7.x86_64.rpm?????????????????????????????????????? |? 32 MB? 00:00:14 (6 /6 ): mysql-community-server-8.0.16-2.el7.x86_64.rpm?????????????????????????????????????? | 403 MB? 00:01:08 ------------------------------------------------------------------------------------------------------------------- 总计?????????????????????????????????????????????????????????????????????????????? 6.2 MB /s ?| 441 MB? 00:01:10 从? file : ///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql ?检索密钥 导入 GPG key 0x5072E1F5: ? 用户ID???? :? "MySQL Release Engineering <mysql-build@oss.oracle.com>" ? 指纹?????? : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 ? 软件包???? : mysql80-community-release-el7-3.noarch (installed) ? 来自?????? :? /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Running transaction check Running transaction? test Transaction? test ?succeeded Running transaction ?? 正在安装??? : mysql-community-common-8.0.16-2.el7.x86_64???????????????????????????????????????????????????? 1 /7 ?? 正在安装??? : mysql-community-libs-8.0.16-2.el7.x86_64?????????????????????????????????????????????????????? 2 /7 ?? 正在安装??? : mysql-community-client-8.0.16-2.el7.x86_64???????????????????????????????????????????????????? 3 /7 ?? 正在安装??? : net-tools-2.0-0.24.20131004git.el7.x86_64????????????????????????????????????????????????????? 4 /7 ?? 正在安装??? : mysql-community-server-8.0.16-2.el7.x86_64???????????????????????????????????????????????????? 5 /7 ?? 正在安装??? : mysql-community-libs-compat-8.0.16-2.el7.x86_64??????????????????????????????????????????????? 6 /7 ?? 正在删除??? : 1:mariadb-libs-5.5.60-1.el7_5.x86_64?????????????????????????????????????????????????????????? 7 /7 ?? 验证中????? : mysql-community-libs-8.0.16-2.el7.x86_64?????????????????????????????????????????????????????? 1 /7 ?? 验证中????? : net-tools-2.0-0.24.20131004git.el7.x86_64????????????????????????????????????????????????????? 2 /7 ?? 验证中????? : mysql-community-libs-compat-8.0.16-2.el7.x86_64??????????????????????????????????????????????? 3 /7 ?? 验证中????? : mysql-community-client-8.0.16-2.el7.x86_64???????????????????????????????????????????????????? 4 /7 ?? 验证中????? : mysql-community-common-8.0.16-2.el7.x86_64???????????????????????????????????????????????????? 5 /7 ?? 验证中????? : mysql-community-server-8.0.16-2.el7.x86_64???????????????????????????????????????????????????? 6 /7 ?? 验证中????? : 1:mariadb-libs-5.5.60-1.el7_5.x86_64?????????????????????????????????????????????????????????? 7 /7 已安装: ?? mysql-community-libs.x86_64 0:8.0.16-2.el7??????????? mysql-community-libs-compat.x86_64 0:8.0.16-2.el7 ?? mysql-community-server.x86_64 0:8.0.16-2.el7 作为依赖被安装: ?? mysql-community-client.x86_64 0:8.0.16-2.el7???????????? mysql-community-common.x86_64 0:8.0.16-2.el7 ?? net-tools.x86_64 0:2.0-0.24.20131004git.el7 替代: ?? mariadb-libs.x86_64 1:5.5.60-1.el7_5 完毕! # 启动mysql # systemctl start mysqld [root@localhost dnt] systemctl start mysqld [root@localhost dnt] pstree |? grep ?mysql ???????? |-mysqld---37*[{mysqld}] # 设置开机启动mysql # systemctl enable mysqld [root@localhost dnt] systemctl? enable ?mysqld [root@localhost dnt] reboot Connection closing...Socket close. Connection closed by foreign host. Disconnected from remote host(MySQL_CentOS) at 10:56:42. Connecting to 192.168.36.205:22... Connection established. To escape to? local ?shell, press? 'Ctrl+Alt+]' . WARNING! The remote SSH server rejected X11 forwarding request. Last login: Wed May 15 10:35:07 2019 from 192.168.36.144 [dnt@localhost ~]$ pstree |? grep ?mysql ???????? |-mysqld---37*[{mysqld}] # 查看mysql的状态 # systemctl status mysqld [dnt@localhost ~]$ systemctl status mysqld ● mysqld.service - MySQL Server ??? Loaded: loaded ( /usr/lib/systemd/system/mysqld .service; enabled; vendor preset: disabled) ??? Active: active (running) since 三 2019-05-15 10:57:26 CST; 1min 3s ago ????? Docs:? man :mysqld(8) ??????????? http: //dev .mysql.com /doc/refman/en/using-systemd .html ?? Process: 3934 ExecStartPre= /usr/bin/mysqld_pre_systemd ?(code=exited, status=0 /SUCCESS ) ? Main PID: 3969 (mysqld) ??? Status:? "SERVER_OPERATING" ??? CGroup:? /system .slice /mysqld .service ??????????? └─3969? /usr/sbin/mysqld |