问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

linux centos用yum怎么安装mysql5.6

发布网友 发布时间:2022-04-23 02:24

我来回答

2个回答

懂视网 时间:2022-05-01 02:23

在Centos7中用MariaDB代替了mysql数据库。所以在新安装MySQL前必须做好对系统的清理工作。

一.清理CentOS7下的MariaDB。

[root@localhost ~]#rpm -qa | gremp mariadb

        [root@localhost ~]# rpm -e --nodeps mariadb.x86_64 1:5.5.41-2.el7_0

二.下载MySQL的yum包

Linux系统自带的repo是不会自动更新每个软件的最新版本(基本都是比较靠后的稳定版),所以无法通过yum方式安装MySQL的高级版本。所以我们需要先安装带有当前可用的mysql5系列社区版资源的rpm包(确保电脑联网)。

        [root@localhost ~]#wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

[root@localhost ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

查看当前可用的mysql安装资源

       [root@localhost ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64  MySQL Connectors Community   21
mysql-tools-community/x86_64       MySQL Tools Community        33
mysql56-community/x86_64           MySQL 5.6 Community Server  214

安装mysql

[root@localhost ~]#yum install mysql-community-server

已加载插件:fastestmirror, langpacks

base                                      | 3.6 kB     00:00    

extras                                    | 3.4 kB     00:00    

mysql-connectors-community                | 2.5 kB     00:00    

mysql-tools-community                     | 2.5 kB     00:00    

mysql56-community                         | 2.5 kB     00:00    

updates                                   | 3.4 kB     00:00    

(1/5): extras/7/x86_64/primary_db         | 117 kB   00:00    

(2/5): mysql-connectors-community/x86_64/primary_db | 9.8 kB   00:00    

(3/5): mysql-tools-community/x86_64/primary_db   |  25 kB   00:01    

(4/5): mysql56-community/x86_64/primary_db       | 115 kB   00:01    

(5/5): updates/7/x86_64/primary_db               | 3.9 MB   00:01    

Determining fastest mirrors

 * base: mirrors.pubyun.com

 * extras: mirrors.pubyun.com

 * updates: mirrors.pubyun.com

正在解决依赖关系

--> 正在检查事务

---> 软件包 mysql-community-server.x86_64.0.5.6.29-2.el7 将被 安装

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

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

--> 正在检查事务

---> 软件包 mysql-community-client.x86_64.0.5.6.29-2.el7 将被 安装

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

---> 软件包 mysql-community-common.x86_64.0.5.6.29-2.el7 将被 安装

--> 正在检查事务

---> 软件包 mysql-community-libs.x86_64.0.5.6.29-2.el7 将被 安装

--> 解决依赖关系完成

 

依赖关系解决

 

=================================================================

 Package        架构      版本           源                  大小

=================================================================

正在安装:

 mysql-community-server    x86_64    5.6.29-2.el7    mysql56-community     58 M

为依赖而安装:

 mysql-community-client    x86_64    5.6.29-2.el7    mysql56-community     19 M

 mysql-community-common    x86_64    5.6.29-2.el7    mysql56-community    256 k

 mysql-community-libs      x86_64    5.6.29-2.el7    mysql56-community    2.0 M

 

事务概要

=================================================================

安装  1 软件包 (+3 依赖软件包)

 

总下载量:79 M

安装大小:344 M

Is this ok [y/d/N]: y

Downloading packages:

警告:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.29-2.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

mysql-community-common-5.6.29-2.el7.x86_64.rpm 的公钥尚未安装

(1/4): mysql-community-common-5.6.29-2.el7.x86_64.rpm      | 256 kB   00:01    

(2/4): mysql-community-libs-5.6.29-2.el7.x86_64.rpm        | 2.0 MB   00:02    

(3/4): mysql-community-server-5.6.29-2.el7.x86_64.rpm      |  58 MB   00:29    

mysql-community-client-5.6.29- FAILED                                          

http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-client-5.6.29-2.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-client-5.6.29-2.el7.x86_64.rpm: (28, ‘Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds‘)

正在尝试其它镜像。

(4/4): mysql-community-client-5.6.29-2.el7.x86_64.rpm      |  19 MB   12:12    

-----------------------------------------------------------------

总计                                    105 kB/s |  79 MB  12:51    

从 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

是否继续?[y/N]:y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

警告:RPM 数据库已被非 yum 程序修改。

正在安装    : mysql-community-common-5.6.29-2.el7.x86_64                  1/4

正在安装    : mysql-community-libs-5.6.29-2.el7.x86_64                    2/4

正在安装    : mysql-community-client-5.6.29-2.el7.x86_64                  3/4

正在安装    : mysql-community-server-5.6.29-2.el7.x86_64                  4/4

warning: /etc/my.cnf created as /etc/my.cnf.rpmnew

验证中      : mysql-community-common-5.6.29-2.el7.x86_64                  1/4

验证中      : mysql-community-libs-5.6.29-2.el7.x86_64                    2/4

验证中      : mysql-community-client-5.6.29-2.el7.x86_64                  3/4

验证中      : mysql-community-server-5.6.29-2.el7.x86_64                  4/4

 

已安装:

mysql-community-server.x86_64 0:5.6.29-2.el7                                 

 

作为依赖被安装:

mysql-community-client.x86_64 0:5.6.29-2.el7                                 

mysql-community-common.x86_64 0:5.6.29-2.el7                                 

mysql-community-libs.x86_64 0:5.6.29-2.el7                                   

 

完毕!

 

三.MySQL安装完成后,进行相关配置

a)   #######安装成功后,将其加入开机启动
systemctl enable mysqld
b) #######启动mysql服务进程
        systemctl start mysqld
        c) #######配置mysql(设置密码等)
        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] y       [禁止root远程登录]
 ... Success!
 
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...

 

四.Yum安装后mysql的文件所在的位置:

/usr/bin(客户端程序和脚本)

/usr/sbin(mysql服务器)

/var/lib/mysql/(日志文件和数据库)

/usr/share/doc/packages(文档)

/usr/include/mysql(包含(头)文件)

/usr/lib/mysql(库文件)

/usr/share/mysql/(错误消息和字符集文件)

/usr/share/sql-bench(基准程序)

五.Yum安装的优缺点

优点:安装简单,适合初学者学习使用

缺点:需要单独下载客户端和服务器;安装路径不灵活,默认路径不能修改,一台服务器只能安装一个MySQL

CentOS7下yum方式安装mysql5.6

标签:

热心网友 时间:2022-04-30 23:31

rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

然后找下是否有mysql5.6
yum list --enablerepo=remi |grep mysql
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
什么样的猫叫起司猫? 2021年春节后工地普遍是哪天开工? 美国大学介绍——印第安纳大学伯明顿分校 480-500分之间的大学有哪些 平安驾意险需要买两份保险吗? AI编译器技术剖析(一)-概述 AI编译器技术剖析(三)-树模型编译工具 Treelite 详解 研究性学习:人工智能产品的个人使用情况调研 全球变化中国现阶段水资源概况 我国水资源人均占有量现在只有 linux上能同时安装mysql5.5和5.6么 Linux server手动下载安装mysql5.6时报错:Neither host &#39;主机名&#39; no... linux编译安装mysql5.6出错?麻烦看看什么原因? 在linux环境下,如何安装和运行mysql 5.6.16.tar.gz? linux中怎么安装mysql5.6.12版本图解 还不会在Linux中安装Mysql? 如何在linux上安装mysql 5.6 怎样保存胡萝卜,放的时间更久? 萝卜的储藏方法? 冬季,又到了白萝卜丰收的时候,萝卜该怎么收藏呢? 大学c语言 大学C语言编程 我作为当一名大学生问问大家,怎么能最快速学到C语言? 大学的C语言真的很难吗 大学C语言学习 我想知道大学里面C语言考试时怎么弄的!难么?还有就是计算机二级考试必须要报考还是? 大学C语言简单编程怎么改错? 大学c语言。怎么做 大学C语言好难,怎么破? 大学C语言怎么学好 红枣玉米馒头怎么做 红枣玉米面窝头怎么做如何做好吃 ...师需要学习多久,思科的ccna,ccnp,ccie需要学习多长时间呢?_百度... 用哪些方法做的玉米面红枣馒头,更加松软香甜? 玉米面和白面混合红枣馒头怎么制作 玉米面怎样发孝才不会酸? 考思科CCIE都需要什么技术基础,比如编程之类的 需要么? 红枣玉米面小窝头怎么做如何做好吃 怎么发玉米面才能发好??? 思科技术有必要往CCIE学么? 松软好吃的玉米面窝窝头要怎么做? 枣窝窝头的做法大全 苹果6隐私中相机未获得权限的图标不显示啊 怎么办。开启,还原设置都试... 发面枣饼子的做法 你好.我的是苹果6访问限制没啦怎么办 怎样做红枣玉米面饼子 苹果6被停用,怎么办? 苹果6apple id被停用怎么办 玉米面枣饼怎么做 苹果6关闭不了软件的联网权限,关闭了又自己打开