本来不准备写这个的,网上太多了,但是情况各有区别,我没有发现一篇我能照着安装成功。经过一番折腾,终于安装完了。
一、首先到官网下载吧:
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的文件冲突?什么意思?查了下:
正在解决依赖关系
--> 正在检查事务
---> 软件包 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 依赖软件包)
是否继续?[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
警告: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%]
警告: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
查看状态:
● 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:56 hostaa systemd[1]: Started MySQL Server.
5月 13 14:05:49 hostaa systemd[1]: Started MySQL Server.
2017-05-13T05:39:44.497086Z 1 [Note] A temporary password is generated for root@localhost: pKsO:Jin<4f%
Your MySQL connection id is 7
Server version: 5.7.18
affiliates. Other names may be trademarks of their respective
owners.
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)
Query OK, 1 row affected (0.01 sec)
mysql> use roger;
Database changed
mysql>
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
|
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
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)
affiliates. Other names may be trademarks of their respective
owners.