CentOS7.2下安装MySQL-5.7.18RPM Bundle版(适用于最新版5.7.20)

一、环境

1、操作系统:CentOS Linux release 7.2.1511 (Core) 最小化安装版
2、MySQL版本:MySQL-5.7.18(mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar)

二、安装过程

1、安装wget。

[root@Geeklp-MySQL ~]# yum -y install wget

2、下载安装包。

wget -c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.18-1.el5.i686.rpm-bundle.tar

3、解包。

[root@Geeklp-MySQL ~]# tar -xf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar

4、按照以下脚本顺序安装各rpm包及其他依赖包。

#!/bin/bash
yum -y install net-tools
tar -xf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar &
yum -y remove mariadb-libs
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
yum -y install perl-Getopt-Long
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm 
yum -y install perl-Data-Dumper
yum -y install perl-JSON
rpm -ivh mysql-community-test-5.7.18-1.el7.x86_64.rpm 
rpm -ivh mysql-community-devel-5.7.18-1.el7.x86_64.rpm

5、启动MySQL服务,记录初始密码。

[root@Geeklp-MySQL ~]# systemctl start mysqld
[root@Geeklp-MySQL ~]# cat /var/log/mysqld.log |grep password
2017-12-13T10:50:44.960028Z 1 [Note] A temporary password is generated for root@localhost: =mWoe;zkj4M3

至此,安装过程完成。

三、配置过程

1、初次登录,修改登录密码。

[root@Geeklp-MySQL ~]# # mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
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> SET PASSWORD = PASSWORD('xwumpmysql,./');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> SET PASSWORD = PASSWORD('Geeklp.0/7');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> quit;
Bye

2、创建数据目录,修改my.cfn配置文件。

[root@Geeklp-MySQL ~]# mkdir /home/data
[root@Geeklp-MySQL ~]# mv /var/lib/mysql /home/data/
[root@Geeklp-MySQL ~]# vi /etc/my.cnf
default-storage-engine=INNODB 
lower_case_table_names = 1

其他更详配置尽介绍请参阅:https://dev.mysql.com/doc/refman/5.7/en/mysqld-option-tables.html
权限重置敬请参阅:https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

上一篇:《Python金融大数据分析》一2.2 结语


下一篇:《Python金融大数据分析》一2.3 延伸阅读