centos自带的repo是不会自动更新每个软件的最新版本,所以无法通过yum方式安装MySQL的高级版本。

所以,即使使劲用yum -y install mysql mysql-server mysql-devel,也是没用的。 
所以,正确的安装mysql5姿势是要先安装带有可用的mysql5系列社区版资源的rpm包

[root@iZ28gvqe4biZ ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
获取http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-release-el7-5 ################################# [100%]

这个时候查看当前可用的mysql安装资源:

[root@iZ28gvqe4biZ ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 17
mysql-tools-community/x86_64 MySQL Tools Community 31
mysql56-community/x86_64 MySQL 5.6 Community Server 199

一般来说,只要安装mysql-server跟mysql-client 
这个时候我们可以直接使用yum的方式安装MySQL了

[root@iZ28gvqe4biZ ~]# yum -y install mysql-community-server
已加载插件:langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.6.28-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.28-2.el7,它被软件包 mysql-community-server-5.6.28-2.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) = 5.6.28-2.el7,它被软件包 mysql-community-server-5.6.28-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 mysql-community-server-5.6.28-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.5.6.28-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-libs(x86-64) = 5.6.28-2.el7,它被软件包 mysql-community-client-5.6.28-2.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.6.28-2.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.40-1.el7_0 将被 取代
---> 软件包 mysql-community-libs.x86_64.0.5.6.28-2.el7 将被 舍弃
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Zlib),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在检查事务
---> 软件包 perl-IO-Compress.noarch.0.2.061-2.el7 将被 安装
--> 正在处理依赖关系 perl(Compress::Raw::Zlib) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Raw::Bzip2) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Compress-Raw-Bzip2.x86_64.0.2.061-3.el7 将被 安装
---> 软件包 perl-Compress-Raw-Zlib.x86_64.1.2.061-4.el7 将被 安装
--> 解决依赖关系完成 依赖关系解决 ==============================================================================================
Package 架构 版本 源 大小
==============================================================================================
正在安装:
mysql-community-libs x86_64 5.6.28-2.el7 mysql56-community 2.0 M
替换 mariadb-libs.x86_64 1:5.5.40-1.el7_0
mysql-community-server x86_64 5.6.28-2.el7 mysql56-community 58 M
为依赖而安装:
mysql-community-client x86_64 5.6.28-2.el7 mysql56-community 19 M
mysql-community-common x86_64 5.6.28-2.el7 mysql56-community 256 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k 事务概要
==============================================================================================
安装 2 软件包 (+8 依赖软件包) 总下载量:80 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.28-2.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
mysql-community-common-5.6.28-2.el7.x86_64.rpm 的公钥尚未安装
(1/10): mysql-community-common-5.6.28-2.el7.x86_64.rpm | 256 kB 00:00:14
(2/10): mysql-community-libs-5.6.28-2.el7.x86_64.rpm | 2.0 MB 00:02:57
(3/10): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(4/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(5/10): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(6/10): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(7/10): perl-PlRPC-0.2020-14.el7.noarch.rpm
(8/10): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(9/10): mysql-community-server-5.6.28-2.el7.x86_64.rpm | 58 MB 00:54:45
(10/10): mysql-community-client-5.6.28-2.el7.x86_64.rpm | 19 MB 00:20:42
总计 13 kB/s | 80 MB 01:45:50
从 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
软件包 : mysql-community-release-el7-5.noarch (installed)
来自 : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在安装 : mysql-community-common-5.6.28-2.el7.x86_64 1/11
正在安装 : mysql-community-libs-5.6.28-2.el7.x86_64 2/11
正在安装 : mysql-community-client-5.6.28-2.el7.x86_64 3/11
正在安装 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/11
正在安装 : perl-Net-Daemon-0.48-5.el7.noarch 5/11
正在安装 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/11
正在安装 : perl-IO-Compress-2.061-2.el7.noarch 7/11
正在安装 : perl-PlRPC-0.2020-14.el7.noarch 8/11
正在安装 : perl-DBI-1.627-4.el7.x86_64 9/11
正在安装 : mysql-community-server-5.6.28-2.el7.x86_64 10/11
正在删除 : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11
验证中 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/11
验证中 : perl-Net-Daemon-0.48-5.el7.noarch 2/11
验证中 : mysql-community-common-5.6.28-2.el7.x86_64 3/11
验证中 : perl-IO-Compress-2.061-2.el7.noarch 4/11
验证中 : mysql-community-libs-5.6.28-2.el7.x86_64 5/11
验证中 : mysql-community-client-5.6.28-2.el7.x86_64 6/11
验证中 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 7/11
验证中 : perl-DBI-1.627-4.el7.x86_64 8/11
验证中 : mysql-community-server-5.6.28-2.el7.x86_64 9/11
验证中 : perl-PlRPC-0.2020-14.el7.noarch 10/11
验证中 : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 11/11 已安装:
mysql-community-libs.x86_64 0:5.6.28-2.el7 mysql-community-server.x86_64 0:5.6.28-2.el7 作为依赖被安装:
mysql-community-client.x86_64 0:5.6.28-2.el7 mysql-community-common.x86_64 0:5.6.28-2.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBI.x86_64 0:1.627-4.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 替代:
mariadb-libs.x86_64 1:5.5.40-1.el7_0 完毕!

加入开机启动

[root@iZ28gvqe4biZ ~]# systemctl enable mysqld

启动mysql服务进程

[root@iZ28gvqe4biZ ~]# systemctl start mysqld

重置密码

[root@iZ28gvqe4biZ ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here. Enter current password for root (enter for none):
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation. Set root password? [Y/n] y [设置root用户密码]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y [删除匿名用户]
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n [禁止root远程登录]
... skipping. By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] y [删除test数据库]
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success! Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] y [刷新权限]
... Success! All done! If you've completed all of the above steps, your MySQL
installation should now be secure. Thanks for using MySQL! Cleaning up...

Centos7使用yum安装MySQL5.6的正确姿势的更多相关文章

  1. 阿里云Centos7使用yum安装MySQL5.6的正确姿势

    阿里云Centos7使用yum安装MySQL5.6 阿里云Centos7使用yum安装MySQL5.6 前言:由于某些不可抗力,我要在自己的阿里云服务器上搭建hadoop+hive+mysql+tom ...

  2. CentOS7 通过YUM安装MySQL5.7 linux

    CentOS7 通过YUM安装MySQL5.7 1.进入到要存放安装包的位置 cd /home/lnmp 2.查看系统中是否已安装 MySQL 服务,以下提供两种方式: rpm -qa | grep  ...

  3. CentOS7使用yum安装mysql5.7

    提前说一下,网速不好不要用yum安装,等得时间太长. 第一步.获取yum源 [root@youxi1 ~]# rpm -ivh https://repo.mysql.com/yum/mysql-5.7 ...

  4. centos7.6 yum安装mysql5.7版本

    由于mysql5.5及之前的版本一些项目上线报错 卸载: 首先删除centos上原来的mysql老版本,注意备份,清理干净. 之前怎么安装的清理,防止卸载不干净会有冲突. 我之前yum安装mysql5 ...

  5. Centos7使用yum安装Mysql5.7.19的详细步骤(可用)

    Centos7的yum源中默认是没有mysql,因为现在已经用mariaDB代替mysql了. 首先我们下载mysql的repo源,我们可以去mysql官网找最新的repo源地址 地址: https: ...

  6. CentOS7通过YUM安装MySQL5.6

    检查系统中的 MySQL,并删除现有的 Mysql 软件包. $ rpm -qa | grep mysql 这里如果没有返回任何东西证明没有安装任何 MySQL 相关的应用.如下图: 由于 cento ...

  7. CentOS7 通过YUM安装MySQL5.7

    1.进入到要存放安装包的位置 cd /home/lnmp 2.查看系统中是否已安装 MySQL 服务,以下提供两种方式: rpm -qa | grep mysql yum list installed ...

  8. CentOS7.4使用yum安装MySQL5.6

    CentOS默认数据库为mariadb可以使用yum安装MySQL5.6 系统版本查看 下载yum源安装 wget http://dev.mysql.com/get/mysql-community-r ...

  9. [转]阿里云CentOS 7.1使用yum安装MySql5.6.24

    阿里云CentOS 7.1使用yum安装MySql5.6.24 作者:vfhky | 时间:2015-06-25 09:43 | 分类:web 在前面两篇文章<2015博客升级记(四):Cent ...

随机推荐

  1. Unicode字符集和UTF-8, UTF-16, UTF-32编码

    ASCII 在过去的计算中,ASCII码被用来表示字符.英语只有26个字母和其他一些特殊字符和符号. 下表提供了ASCII字符及其相应的十进制和十六进制值. 可以从上面的表中推断,在十进制数系统中,A ...

  2. 《OpenGL编程指南第七版》学习——编译时提示“error C2381: “exit” : 重定义;__declspec(noreturn) 不同”错误的解决办法

    解决办法一. #if defined(_WIN32) # ifndef GLUT_BUILDING_LIBextern _CRTIMP void __cdecl exit(int); 上面是glut. ...

  3. VS2012与VS2015同时安装用VS2012创建MFC程序时弹出编译错误”fatal error C1083: 无法打开包括文件:“mprapidef.h”: No such file or directory”的解决办法

    在WIndows 7操作系统上同时安装VS2012与VS2015并用VS2012创建MFC程序时弹出编译错误”fatal error C1083: 无法打开包括文件:“mprapidef.h”: No ...

  4. php版本跟扩展模块版本不兼容问题

    安装redis扩展后查看时候出现了这样报错: [root@localhost phpredis-develop]# php -m | grep redisPHP Warning: PHP Startu ...

  5. PAT——1056. 组合数的和

    给定N个非0的个位数字,用其中任意2个数字都可以组合成1个2位的数字.要求所有可能组合出来的2位数字的和.例如给定2.5.8,则可以组合出:25.28.52.58.82.85,它们的和为330. 输入 ...

  6. LWIP2.0.2 & FreeRTOS & MQTT 客户端的 使用

    1.参考链接 :http://www.nongnu.org/lwip/2_0_x/group__mqtt.html 2.首先移植好lwip,然后添加lwip-2.0.2\src\apps\mqtt   ...

  7. iOS之面试题:腾讯三次面试以及参考思路

    使用了第三方库, 有看他们是怎么实现的吗? 例:SD.YY.AFN.MJ等! <1>.SD为例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...

  8. Mysql数据库-DAY2

    查找 Select 字段(全部查找为*)from 表 增加 Insert into 字段(全部增加为表) values(需要增加的内容,用'','隔开') 删除 Delete from 表 where ...

  9. 在vscode中使用webpack中安装的echarts文件失败,dom获取class名,图表不显示

    所有的东西都是新学的,所以遇到了很多问题: (1)首先,在电脑上已经安装了node的情况下, 在npm中安装echarts:npm install echarts --save mac系统在最前面加上 ...

  10. PHP-----PHP程序设计基础教程----第二章PHP基本语法

    博文结构: 2.1 PHP语法风格 2.1.1 PHP标记 PHP有四种风格的标记,具体如表2-1所示: 表2-1 PHP开始和结束标记 标记类型 开始标记 结束标记 示例 说明 标准标记 <? ...