Mysql 使用yum 切换源


[root@juny-18 ~]# cat /etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

网络yum源已经配好

检查系统是否自带有MySQL

[root@juny-18 ~]# yum list installed | grep mysql

如果有就用下面这命令来删除

Yum remove -y (安装包名)

第一步 下载yum库

[root@juny-18 ~]# wget //dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

--2017-11-01 23:33:57-- //dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11

正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... 已连接。

中间有省略下载信息

正在保存至: "mysql57-community-release-el7-8.noarch.rpm"

100%[===========================================================================>] 9,116 --.-K/s 用时 0s

2017-11-01 23:35:29 (84.3 MB/s) - 已保存 "mysql57-community-release-el7-8.noarch.rpm" [9116/9116])

安装MySQL的yum源

[root@juny-18 ~]# yum localinstall mysql57-community-release-el7-8.noarch.rpm

已加载插件:fastestmirror, langpacks

正在检查 mysql57-community-release-el7-8.noarch.rpm: mysql57-community-release-el7-8.noarch

mysql57-community-release-el7-8.noarch.rpm 将被安装

正在解决依赖关系

There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).

--> 正在检查事务

---> 软件包 mysql57-community-release.noarch.0.el7-8 将被 安装

--> 解决依赖关系完成

中间有省略下载信息

正在安装 : mysql57-community-release-el7-8.noarch 1/1

验证中 : mysql57-community-release-el7-8.noarch 1/1

已安装:

mysql57-community-release.noarch 0:el7-8

完毕!

检查MySQL源的安装是否成功

[root@juny-18 ~]# yum repolist enabled | grep "mysql.*-community.*"

mysql-connectors-community/x86_64 MySQL Connectors Community 42

mysql-tools-community/x86_64 MySQL Tools Community 51

mysql57-community/x86_64 MySQL 5.7 Community Server 227

修改MySQL的yum源

修改前

陈俊勇:centos 7 下yum三步安装MySQL5.7 不信进去瞅瞅

修改后

陈俊勇:centos 7 下yum三步安装MySQL5.7 不信进去瞅瞅

第二步 开始安装MySQL5.7数据库

[root@juny-18 ~]# yum install mysql-community-server -y

正在解决依赖关系

There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).

--> 正在检查事务

---> 软件包 mysql-community-server.x86_64.0.5.7.20-1.el7 将被 安装

--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.20-1.el7,它被软件包 mysql-community-server-5.7.20-1.el7.x86_64 需要

--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.20-1.el7.x86_64 需要

--> 正在检查事务

---> 软件包 mysql-community-client.x86_64.0.5.7.20-1.el7 将被 安装

--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.20-1.el7.x86_64 需要

---> 软件包 mysql-community-common.x86_64.0.5.7.20-1.el7 将被 安装

--> 正在检查事务

---> 软件包 mariadb-libs.x86_64.1.5.5.52-1.el7 将被 取代

--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要

--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要

---> 软件包 mysql-community-libs.x86_64.0.5.7.20-1.el7 将被 舍弃

--> 正在检查事务

---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.20-1.el7 将被 舍弃

--> 解决依赖关系完成

依赖关系解决

中间有省略下载信息

事务概要

已安装:

mysql-community-libs.x86_64 0:5.7.20-1.el7 mysql-community-libs-compat.x86_64 0:5.7.20-1.el7

mysql-community-server.x86_64 0:5.7.20-1.el7

作为依赖被安装:

mysql-community-client.x86_64 0:5.7.20-1.el7 mysql-community-common.x86_64 0:5.7.20-1.el7

替代:

mariadb-libs.x86_64 1:5.5.52-1.el7

完毕!

第三步、启动MySQL

[root@juny-18 ~]# systemctl start mysqld

获取临时密码

陈俊勇:centos 7 下yum三步安装MySQL5.7 不信进去瞅瞅

进入mysql

[root@juny-18 ~]# mysql -uroot -pfjw_qP%V0lp#

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 3

Server version: 5.7.20

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

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>

修改密码

mysql> set password for 'root'@'localhost'=password('你的密码');

设置开机启动

[root@juny-18 ~]# systemctl enable mysqld

[root@juny-18 ~]# systemctl daemon-reload



@来源

陈俊勇:centos 7 下yum三步安装MySQL5.7 不信进去瞅瞅


    吾之爱,心之念。
           携子手,到白头。

原文地址:https://www.cnblogs.com/JC-0527/p/7770577.html