关闭

centos7安装mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

标签: 数据库mysqlcentos安装
5872人阅读 评论(5) 收藏 举报
分类:

本来不准备写这个的,网上太多了,但是情况各有区别,我没有发现一篇我能照着安装成功。经过一番折腾,终于安装完了。

一、首先到官网下载吧:

https://dev.mysql.com/downloads/file/?id=469456

二、解压:

#tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

解压后有如下rpm:

[root@hostaa mysql_rpm]# ls -l
总用量 1141908
-rw-r--r-- 1 root root  584652800 5月  13 01:02 mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 7155 31415  25079412 3月  20 17:40 mysql-community-client-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415    277784 3月  20 17:40 mysql-community-common-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415   3777808 3月  20 17:40 mysql-community-devel-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  45493312 3月  20 17:40 mysql-community-embedded-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  23924496 3月  20 17:40 mysql-community-embedded-compat-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 126060264 3月  20 17:40 mysql-community-embedded-devel-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415   2237888 3月  20 17:40 mysql-community-libs-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415   2113196 3月  20 17:40 mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  54661812 3月  20 17:40 mysql-community-minimal-debuginfo-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 169622200 3月  20 17:41 mysql-community-server-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415  14501488 3月  20 17:41 mysql-community-server-minimal-5.7.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 116887988 3月  20 17:41 mysql-community-test-5.7.18-1.el7.x86_64.rpm

三、一个rpm一个rpm的来安装吧

这里要注意安装顺序,但是其实不用记顺序。

比如我先安装server吧:(如果没有安装common和client就会报错)

#rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
        mysql-community-client(x86-64) >= 5.7.9 被 mysql-community-server-5.7.18-1.el7.x86_64 需要
        mysql-community-common(x86-64) = 5.7.18-1.el7 被 mysql-community-server-5.7.18-1.el7.x86_64 需要

有人说可以取消依赖:#rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm --nodeps,但是个人不建议这么做,安装好后可能也会有问题,rpm都有了,依赖检测失败你就装上依赖就是了。


3.1好吧,那就先安装common吧

  # rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
        file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64conflicts with filefrom package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
       ... ...
        file /usr/share/mysql/estonian/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
        file /usr/share/mysql/french/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64

       ... ...

来自mysql-ccommunity-common-5.7.18-1.el7.x86_的文件和mariadb-libs-1:5.5.44-2.el7.centos.x86_64的文件冲突?什么意思?查了下:

出现以上安装错误列表的原因是:系统已经安装了其他版本的mysql-libs包和mysql数据库文件导致不兼容
解决:# yum remove mysql-libs  
------------------------------------------------------------------------------------------------------------------------
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.44-2.el7.centos 将被 删除
--> 正在处理依赖关系 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 需要
--> 正在检查事务
---> 软件包 postfix.x86_64.2.2.10.1-6.el7 将被 删除
--> 解决依赖关系完成
base/7/x86_64                                                                                                   | 3.6 kB  00:00:00    
extras/7/x86_64                                                                                                 | 3.4 kB  00:00:00    
updates/7/x86_64                                                                                                | 3.4 kB  00:00:00    
依赖关系解决
=======================================================================================================================================
 Package                         架构                      版本                                     源                            大小
=======================================================================================================================================
正在删除:
 mariadb-libs                    x86_64                    1:5.5.44-2.el7.centos                    @anaconda                    4.4 M
为依赖而移除:
 postfix                         x86_64                    2:2.10.1-6.el7                           @anaconda                     12 M
事务概要
=======================================================================================================================================
移除  1 软件包 (+1 依赖软件包)
安装大小:17 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 4 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
icedtea-web-1.6.1-4.el7.x86_64 有缺少的需求 java-1.8.0-openjdk
jline-1.0-8.el7.noarch 有缺少的需求 java >= ('0', '1.5', None)
1:libreoffice-core-4.3.7.2-5.el7.x86_64 有缺少的需求 java-headless >= ('1', '1.6', None)
1:libreoffice-ure-4.3.7.2-5.el7.x86_64 有缺少的需求 libjvm.so()(64bit)
  正在删除    : 2:postfix-2.10.1-6.el7.x86_64                                                                                      1/2
  正在删除    : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                                          2/2
  验证中      : 1:mariadb-libs-5.5.44-2.el7.centos.x86_64                                                                          1/2
  验证中      : 2:postfix-2.10.1-6.el7.x86_64                                                                                      2/2
删除:
  mariadb-libs.x86_64 1:5.5.44-2.el7.centos                                                                                           
作为依赖被删除:
  postfix.x86_64 2:2.10.1-6.el7                                                                                                       
完毕!
------------------------------------------------------------------------------------------------------------------------------------------------------------
类似的错误,都可以先试试彻底从centos中卸载mysql。

3.2然后再重新安装依次安装吧:
# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-common-5.7.18-1.e################################# [100%]
# rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-libs-5.7.18-1.el7################################# [100%]
# rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-client-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-client-5.7.18-1.e################################# [100%]
# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-server-5.7.18-1.e################################# [100%]

# rpm -ivh mysql-community-devel-5.7.18-1.el7.x86_64.rpm (可选安装)
警告:mysql-community-devel-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-devel-5.7.18-1.el################################# [100%]


四、启动:

# systemctl start mysqld

查看状态:

# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active:
active (running)since 六 2017-05-13 13:39:56 CST; 28min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 5791 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 5714 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 5795 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─5795 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
5月 13 13:39:28 hostaa systemd[1]: Starting MySQL Server...
5月 13 13:39:56 hostaa systemd[1]: Started MySQL Server.
5月 13 14:05:49 hostaa systemd[1]: Started MySQL Server.

五、登陆:
这种方式安装好后,会再my.cnf文件中自动生成一个密码,执行看一下吧:
# cat /var/log/mysqld.log | grep password
2017-05-13T05:39:44.497086Z 1 [Note] A temporary password is generated for root@localhost:
pKsO:Jin<4f%
密码就是这么复杂,复制吧,不然手输还容易出错。
登陆:#mysql -u root -p
Enter password:pKsO:Jin<4f%
Welcome to the MySQL monitor.  Commands end with ; or \g
Your MySQL connection id is 7
Server version: 5.7.18
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>
.--登陆成功,但是这时候,还不能做任何事情。随便你做什么都会提示你:
ERROR 1820 (HY000): You must reset your passwordusing ALTER USER statement before executing this statement.
那就来reset吧:
mysql> SET PASSWORD = PASSWORD('Mysql5718');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
(密码过于简单,必须大写,小写,数字,符号)
mysql> SET PASSWORD = PASSWORD('Mysql5718%');
Query OK, 0 rows affected, 1 warning (0.00 sec)
好了,现在终于可以操作了:
mysql> create database roger; 
Query OK, 1 row affected (0.01 sec)
mysql> use roger; 
Database changed
mysql>
额外:一般自己装个mysql就是用来测试的,结果密码还那么麻烦,哪天忘记了都有可能,想要设置简单的密码,把密码安全级别设置低一点吧:
mysql> set global validate_password_policy=0;//0最低,1中级,2最强验证级别
Query OK, 0 rows affected (0.00 sec)
Policy Tests Performed
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG
Length; numeric, lowercase/uppercase, and special characters; dictionary file


六、授权远程连接:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Mysql5718%' WITH GRANT OPTION;         
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> FLUSH PRIVILEGES;  
Query OK, 0 rows affected (0.01 sec)
这样,我们就可以在其他电脑上的mysql客户端远程连接linux上的mysql数据库了:(例如在win cmd里面)
C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin>mysql -u root -pMysql5718% -h 192.168.231.8 -D roger
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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>
(如果连不上,看看是不是防火墙开着的。)

(写得很用心,看完了,请留下你们得足迹吧!)


9
0
查看评论
发表评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场

使用VMware安装CentOS7详请

话不多说直接开车,乘客坐稳了 准备资料: CentOS-7-x86_64-Everything-1611 对资料就这些 第一步点击
  • hui_2016
  • hui_2016
  • 2017-03-31 17:28
  • 3394

VM虚拟机下安装centos7教程

首先下载centos7,我用的是CentOS-7-x86_64-DVD-1503-01,差不多4G左右,如果网络不稳定,建议用百度云下载,支持断点下载,下面开始进行安装步骤: Linux参考教程htt...
  • u012510757
  • u012510757
  • 2017-03-30 11:02
  • 1004

Redis在Centos7上的安装部署

简介:Redis是一种高级key-value数据库。它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富。有字符串,链表,集 合和有序集合。支持在服务器端计算集合的并,交和补集(d...
  • baidu_30000217
  • baidu_30000217
  • 2016-05-22 21:23
  • 15526

Linux Centos7下ZooKeeper集群安装详细步骤

1.下载zookeeperwget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz2.解压zookee...
  • RobertoHuang
  • RobertoHuang
  • 2017-03-21 19:34
  • 782

CentOS7_Linux初次安装(转自鸟哥)

在硬盘上分出40GB的空间安装Linux,空间分配如下: 所需目录 磁盘容量 文件系统 分区格式 BIOS boot 2MB 系統自訂 主分区 /boot 1GB xfs 主分区 ...
  • z605928171
  • z605928171
  • 2016-08-13 16:37
  • 2686

VM虚拟机下安装Centos7图文教程

VM上安装CentOS7
  • zxf8111
  • zxf8111
  • 2016-10-21 14:16
  • 1956

CentOS7下安装配置Jenkins

前面简单介绍了下CentOS7下安装配置nuxus和CentOS7下防火墙的配置,今天继续介绍CentOS7下jenkins的安装配置。        我在安装配置时,用的是jenkins的rpm包,...
  • dandanzmc
  • dandanzmc
  • 2016-07-18 00:23
  • 11252

从最小化安装开始搞CentOS7

CentOS7 最小化安装(minimal)安装过程: 1.去官网下载最新版的CentOS7最小化ISO, http://centos.org 如果被墙掉,可以找 清华大学镜像源:https:...
  • qq_33182045
  • qq_33182045
  • 2017-02-18 17:21
  • 708

CentOS7安装Apache服务器

centos安装Apache
  • xiongxianze
  • xiongxianze
  • 2016-11-28 17:41
  • 2366

CentOS7安装GNOME图形界面

CentOS7安装GNOME图形界面我是在虚拟机下安装GNOME的,在真实系统中安装过程类似。1. 准备安装介质 下载iso文件 阿里云上的镜像下载地址 创建安装优盘(仅真实系统需要)准备1个空白的...
  • martinwangjun
  • martinwangjun
  • 2016-05-16 13:08
  • 1684
    个人资料
    • 访问:21520次
    • 积分:373
    • 等级:
    • 排名:千里之外
    • 原创:11篇
    • 转载:7篇
    • 译文:2篇
    • 评论:10条
    文章分类
    最新评论