Centos 6.5 安装 mysql 5.7

下载 mysql57-community-release-el6-9.noarch.rpm及mysql-community-server-5.7.17-1.el6.x86_64.rpm两个软件包

1.安装mysql57-community-release-el6-9.noarch.rpm

[root@nmb1 ~]# rpm -ivh mysql57-community-release-el6-9.noarch.rpm
warning: mysql57-community-release-el6-9.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
1:mysql57-community-relea########################################### [100%]

2.安装mysql依赖包

[root@nmb1 ~]# yum -y install mysql-community-client numactl
已加载插件:fastestmirror
设置安装进程
Determining fastest mirrors
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.sohu.com
* updates: mirrors.tuna.tsinghua.edu.cn
mysql-connectors-community | 2.5 kB 00:00
mysql-connectors-community/primary_db | 13 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql-tools-community/primary_db | 34 kB 00:00
mysql57-community | 2.5 kB 00:00
mysql57-community/primary_db | 102 kB 00:00
解决依赖关系
--> 执行事务检查
---> Package mysql-community-client.x86_64 0:5.7.17-1.el6 will be 安装
--> 处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.17-1.el6.x86_64 需要
---> Package numactl.x86_64 0:2.0.9-2.el6 will be 安装
--> 执行事务检查
---> Package mysql-community-libs.x86_64 0:5.7.17-1.el6 will be obsoleting
--> 处理依赖关系 mysql-community-common(x86-64) >= 5.7.9,它被软件包 mysql-community-libs-5.7.17-1.el6.x86_64 需要
---> Package mysql-libs.x86_64 0:5.1.73-7.el6 will be 取代
--> 处理依赖关系 libmysqlclient.so.16()(64bit),它被软件包 2:postfix-2.6.6-6.el6_7.1.x86_64 需要
--> 处理依赖关系 libmysqlclient.so.16(libmysqlclient_16)(64bit),它被软件包 2:postfix-2.6.6-6.el6_7.1.x86_64 需要
--> 执行事务检查
---> Package mysql-community-common.x86_64 0:5.7.17-1.el6 will be 安装
---> Package mysql-community-libs-compat.x86_64 0:5.7.17-1.el6 will be obsoleting
--> 完成依赖关系计算

依赖关系解决

================================================================================================================
软件包 架构 版本 仓库 大小
================================================================================================================
正在安装:
mysql-community-client x86_64 5.7.17-1.el6 mysql57-community 23 M
mysql-community-libs x86_64 5.7.17-1.el6 mysql57-community 2.1 M
replacing mysql-libs.x86_64 5.1.73-7.el6
mysql-community-libs-compat x86_64 5.7.17-1.el6 mysql57-community 1.6 M
replacing mysql-libs.x86_64 5.1.73-7.el6
numactl x86_64 2.0.9-2.el6 base 74 k
为依赖而安装:
mysql-community-common x86_64 5.7.17-1.el6 mysql57-community 328 k

事务概要
================================================================================================================
Install 5 Package(s)

总下载量:27 M
下载软件包:
(1/5): mysql-community-client-5.7.17-1.el6.x86_64.rpm | 23 MB 00:26
(2/5): mysql-community-common-5.7.17-1.el6.x86_64.rpm | 328 kB 00:00
(3/5): mysql-community-libs-5.7.17-1.el6.x86_64.rpm | 2.1 MB 00:01
(4/5): mysql-community-libs-compat-5.7.17-1.el6.x86_64.rpm | 1.6 MB 00:01
(5/5): numactl-2.0.9-2.el6.x86_64.rpm | 74 kB 00:00
----------------------------------------------------------------------------------------------------------------
总计 932 kB/s | 27 MB 00:29
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
Package: mysql57-community-release-el6-9.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
正在安装 : mysql-community-common-5.7.17-1.el6.x86_64 1/6
正在安装 : mysql-community-libs-5.7.17-1.el6.x86_64 2/6
正在安装 : mysql-community-libs-compat-5.7.17-1.el6.x86_64 3/6
正在安装 : mysql-community-client-5.7.17-1.el6.x86_64 4/6
正在安装 : numactl-2.0.9-2.el6.x86_64 5/6
正在删除 : mysql-libs-5.1.73-7.el6.x86_64 6/6
Verifying : mysql-community-libs-compat-5.7.17-1.el6.x86_64 1/6
Verifying : numactl-2.0.9-2.el6.x86_64 2/6
Verifying : mysql-community-client-5.7.17-1.el6.x86_64 3/6
Verifying : mysql-community-common-5.7.17-1.el6.x86_64 4/6
Verifying : mysql-community-libs-5.7.17-1.el6.x86_64 5/6
Verifying : mysql-libs-5.1.73-7.el6.x86_64 6/6

已安装:
mysql-community-client.x86_64 0:5.7.17-1.el6 mysql-community-libs.x86_64 0:5.7.17-1.el6
mysql-community-libs-compat.x86_64 0:5.7.17-1.el6 numactl.x86_64 0:2.0.9-2.el6

作为依赖被安装:
mysql-community-common.x86_64 0:5.7.17-1.el6

替代:
mysql-libs.x86_64 0:5.1.73-7.el6

完毕!

3.安装mysql-server

[root@nmb1 ~]# rpm -ivh mysql-community-server-5.7.17-1.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]

4.启动mysqld

[root@nmb1 ~]# service mysqld start
初始化 MySQL 数据库:                                      [确定]
Installing validate password plugin:                       [确定]
正在启动 mysqld:                                          [确定]

5.查看mysql 5.7安装时的初始化密码

[root@nmb1 ~]# grep 'temporary password' /var/log/mysqld.log
2017-03-26T22:05:05.842897Z 1 [Note] A temporary password is generated for root@localhost: lo!lbrLjk9r7

6.更改初始化密码

[root@nmb1 ~]# mysql -uroot -p'lo!lbrLjk9r7'
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 4
Server version: 5.7.17

Copyright (c) 2000, 2016, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Hi$12345';
Query OK, 0 rows affected (0.00 sec)

mysql> 

注:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误。如想更改密码策略请链接至:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

2017-3-27 14:33:20

 

点赞