images\cherry_red.png1 实训二前期LNMP简易架构
      images\cherry_blue.png1.1 php server安装
      images\cherry_blue.png1.2 安装初始化数据库
   images\cherry_red.png2 Mysql数据库
      images\cherry_blue.png2.1 Mysql5.7安装
         images\cherry_orange.png2.1.1 rpm安装
         images\cherry_orange.png2.1.2 yum安装
         images\cherry_orange.png2.1.3 源码安装
         images\cherry_orange.png2.1.4 编译好的非rpm包安装
         images\cherry_orange.png2.1.5 my.cnf常见选项
      images\cherry_blue.png2.2 Mysql基础
         images\cherry_orange.png2.2.1 MySql数据库操作
         images\cherry_orange.png2.2.2 MySql数据类型
            images\cherry_cyan.png2.2.2.1 整型
            images\cherry_cyan.png2.2.2.2 浮点数和定数
            images\cherry_cyan.png2.2.2.3 字符串类型
            images\cherry_cyan.png2.2.2.4 日期和时间类型
            images\cherry_cyan.png2.2.2.5 字段修饰和约束
            images\cherry_cyan.png2.2.2.6 业务建表练习
         images\cherry_orange.png2.2.3 MySql表操作
         images\cherry_orange.png2.2.4 MySql体系结构
         images\cherry_orange.png2.2.5 MySql存储引擎
      images\cherry_blue.png2.3 MySql操作
         images\cherry_orange.png2.3.1 MySql数据操作
         images\cherry_orange.png2.3.2 MySql单表查询
         images\cherry_orange.png2.3.3 MySql多表查询
         images\cherry_orange.png2.3.4 MySql存储过程与函数
      images\cherry_blue.png2.4 MySql操作-2
         images\cherry_orange.png2.4.1 MySql安全机制
         images\cherry_orange.png2.4.2 MySql日志管理
         images\cherry_orange.png2.4.3 MySql复制概述
         images\cherry_orange.png2.4.4 主从同步
      images\cherry_blue.png2.5 最基本sql语句及主从架构
      images\cherry_blue.png2.6 MyCat中间件
         images\cherry_orange.png2.6.1 部署Mycat
         images\cherry_orange.png2.6.2 配置读写分离
            images\cherry_cyan.png2.6.2.1 安全的读写分离
         images\cherry_orange.png2.6.3 XML语法格式
         images\cherry_orange.png2.6.4 mycat 分表分库
      images\cherry_blue.png2.7 Mysql MHA
         images\cherry_orange.png2.7.1 MHA-部署
         images\cherry_orange.png2.7.2 MHA-故障切换VIP透明
            images\cherry_cyan.png2.7.2.1 VIP切换脚本内容
            images\cherry_cyan.png2.7.2.2 VIP-手动在线切换脚本
         images\cherry_orange.png2.7.3 MHA+Mycat高可用Mysql读写分离
         images\cherry_orange.png2.7.4 MHA+VIP+Mycat
         images\cherry_orange.png2.7.5 MHA-故障切换邮件报警
         images\cherry_orange.png2.7.6 自动配置Slave主机
   images\cherry_red.png3 实验
      images\cherry_blue.png3.1 mysql授权问题
      images\cherry_blue.png3.2 1.单节点数据库
      images\cherry_blue.png3.3 2.主从同步
      images\cherry_blue.png3.4 3.实验(高可用)
         images\cherry_orange.png3.4.1 高可用keepalived
            images\cherry_cyan.png3.4.1.1 keepalived install
      images\cherry_blue.png3.5 4.实验(高可用+大并发)
         images\cherry_orange.png3.5.1 HAproxy代理
      images\cherry_blue.png3.6 4.实验(mycat-读写分离)
         images\cherry_orange.png3.6.1 mycat安装部署
         images\cherry_orange.png3.6.2 读写分离高可用
         images\cherry_orange.png3.6.3 mycat管理端口命令
      images\cherry_blue.png3.7 5.双主双从-读写分离-高可用
      images\cherry_blue.png3.8 6.mycat分库操作
      images\cherry_blue.png3.9 7.mycat分表
      images\cherry_blue.png3.10 8.mycat分库分表之下实现读写分离
   images\cherry_red.png4 Shell脚本编程
   images\cherry_red.png5 Zabbix监控
      images\cherry_blue.png5.1 zabbix设置邮件报警--自定义报警媒介
      images\cherry_blue.png5.2 zabbix解决中文界面乱码问题
      images\cherry_blue.png5.3 ziabbix自带的template Linux OS
      images\cherry_blue.png5.4 zabbix-agent自定义收集数据
      images\cherry_blue.png5.5 zabbix监控Nginx性能
      images\cherry_blue.png5.6 综合配置
      images\cherry_blue.png5.7 实验:监控nginx端口实现告警
   images\cherry_red.png6 ELK日志分析
      images\cherry_blue.png6.1 PS
      images\cherry_blue.png6.2 es-head插件安装
      images\cherry_blue.png6.3 安装filebeat nginx日志模板

1、下载对应平台已编译好的包:https://dev.mysql.com/downloads/mysql/5.7.html#downloads
images\8-1.png


2.解压
[root@localhost soft]# tar xvf mysql-5.7.24-el7-x86_64.tar.gz
将解压在当前的mysql目录剪切到 /usr/local/mysql (相当于安装路径为/usr/local/mysql)
[root@localhost soft]# mv ./mysql-5.7.24-el7-x86_64 /usr/local/mysql
[root@localhost soft]# cd /usr/local/mysql/
[root@localhost mysql]# ls
bin COPYING docs include lib man README share support-files

3.执行mysqld 初始化安装
将/usr/local/mysql/bin/ 命令添加到PATH环境变量 便于mysql命令的执行
[root@localhost mysql]# echo "PATH=${PATH}:/usr/local/mysql/bin/" >> /etc/profile
[root@localhost mysql]# source /etc/profile
[root@localhost mysql]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/arm-gcc/bin:/root/bin:/usr/local/mysql/bin/

添加mysql用户与组
[root@localhost mysql]# groupadd -g 27 mysql
[root@localhost mysql]# useradd -u 27 -g 27 -M -s /sbin/nologin mysql

更改/usr/local/mysql中所有文件的mysql所属
[root@localhost mysql]# chown -R mysql:mysql /usr/local/mysql/

初始化
[root@localhost mysql]# ls /var/mysql
ls: 无法访问/var/mysql: 没有那个文件或目录
[root@localhost mysql]# mysqld --initialize --defaults-file=/etc/my.cnf --user=mysql --basedir=/usr/local/mysql --datadir=/var/mysql

注意初始密码:
images\8-2.png


初始安装完毕查看
[root@localhost mysql]# ls /var/mysql/
auto.cnf ib_buffer_pool ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema sys

配置/etc/my.cnf文件
#########################################
#The MySql Client
[client]
port=3306
socket=/var/mysql/mysql.sock

#The MySql Server
[mysqld]
port=3306
user=mysql
#套接字文件默认为/tmp/mysql.sock 修改后要指定[client]对应选项
socket=/var/mysql/mysql.sock
#进程文件
pid-file=/var/mysql/mysql.pid
basedir=/usr/local/mysql
datadir=/var/mysql
#执行临时文件 /var/mysql/tmp 默认不存在要创建(mkdir chown)
tmpdir=/var/mysql/tmp

#日志
[mysqld_safe]
log-error=/var/log/mysql/mysql-err.log
#########################################



images\8-3.png

解决方案:/etc/my.cnf增加
explicit_defaults_for_timestamp=true

images\8-4.png

解决方案:/etc/my.cnf增加
skip-ssl


4.登陆MySql数据库修改密码
mysql -uroot -p"初始密码"
mysql> alter user 'root'@'localhost' identified by '123456';
mysql> FLUSH PRIVILEGES