MYSQL小版本升级(5.7.21至5.7.25)
1.环境确认
[root@mysql ~]# ps -ef |grep -i mysql
root 9173 1 0 2020 ? 00:00:00 /bin/sh /mysql/data/mysql-5.7.21/bin/mysqld_safe --datadir=/mysql/data/mysql-5.7.21/data --pid-file=/mysql/data/mysql-5.7.21/data/mysqld.pid
mysql 9367 9173 0 2020 ? 06:07:52 /mysql/data/mysql-5.7.21/bin/mysqld --basedir=/mysql/data/mysql-5.7.21 --datadir=/mysql/data/mysql-5.7.21/data --plugin-dir=/mysql/data/mysql-5.7.21/lib/plugin --user=mysql --log-error=/mysql/data/mysql-5.7.21/data/mysqld.log --pid-file=/mysql/data/mysql-5.7.21/data/mysqld.pid --socket=/tmp/mysql.sock --port=3306
root 17045 17002 0 09:36 pts/0 00:00:00 grep --color=auto -i mysql mysql -uroot -pmysql@2020 mysql -e "SELECT table_schema,SUM(data_length+index_length)/1024/1024 AS total_mb,SUM(data_length)/1024/1024 AS data_mb,SUM(index_length)/1024/1024 AS index_mb, SUM(data_free)/1024/1024 AS free_mb,COUNT(*) AS tables_num,CURDATE() AS today FROM information_schema.tables where table_schema not in ('mysql','sys','information_schema','performance_schema') GROUP BY table_schema ORDER BY total_mb desc\G"
*************************** 1. row ***************************
table_schema: app_manager
total_mb: 153.42434692
data_mb: 138.15676880
index_mb: 15.26757813
free_mb: 14.00000000
tables_num: 19
today: 2021-06-07
*************************** 2. row ***************************
table_schema: lifeapp_config
total_mb: 0.14376068
data_mb: 0.11055756
index_mb: 0.03320313
free_mb: 0.00000000
tables_num: 8
today: 2021-06-07
2 rows in set (0.01 sec) =============================
2.新环境准备
mkdir -p /mysql/data/mysql-5.7.25/data
chown -R mysql:mysql /mysql/data/mysql-5.7.25/
chmod 750 /mysql/data/mysql-5.7.25/ cd /mysql/data/
tar -zxf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.25-linux-glibc2.12-x86_64 mysql-5.7.25
chown -R mysql.mysql mysql-5.7.25
3.关闭原环境
tail -100f /mysql/data/mysql-5.7.21/data/mysqld.log
/mysql/data/mysql-5.7.21/bin/mysqladmin -uroot -p'mysql@2020' shutdown cp /etc/my.cnf /etc/my.cnf.07bak
cp -rp /mysql/data/mysql-5.7.21/data/* /mysql/data/mysql-5.7.25/data/
4.启动新环境
/mysql/data/mysql-5.7.25/mysql-5.7.25-linux-glibc2.12-x86_64/bin/mysqld --basedir=/mysql/data/mysql-5.7.25 --datadir=/mysql/data/mysql-5.7.25/data --plugin-dir=/mysql/data/mysql-5.7.25/mysql-5.7.25-linux-glibc2.12-x86_64/lib/plugin --user=mysql --log-error=/mysql/data/mysql-5.7.25/data/mysqld.log --pid-file=/mysql/data/mysql-5.7.25/data/mysqld.pid --socket=/tmp/mysql.sock --port=3306 --skip-grant-tables --skip-networking &
5.升级数据字典
/mysql/data/mysql-5.7.25/mysql-5.7.25-linux-glibc2.12-x86_64/bin/mysql_upgrade -S /tmp/mysql.sock /mysql/data/mysql-5.7.25/mysql-5.7.25-linux-glibc2.12-x86_64/bin/mysqladmin -S /tmp/mysql.sock -uroot -p'mysql@2020' shutdown
6.修改环境变量
vi /etc/profile
PATH=$PATH:/mysql/data/mysql-5.7.21/bin
改为
PATH=$PATH:/mysql/data/mysql-5.7.25/mysql-5.7.25-linux-glibc2.12-x86_64/bin 退出重新登陆加载环境变量并确认:
which mysql
7.修改参数文件
vi /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES basedir = /mysql/data/mysql-5.7.25
datadir = /mysql/data/mysql-5.7.25/data
port = 3306
socket = /tmp/mysql.sock
character-set-server=utf8 log-error = /mysql/data/mysql-5.7.25/data/mysqld.log
pid-file = /mysql/data/mysql-5.7.25/data/mysqld.pid
8.启动环境
/mysql/data/mysql-5.7.25/mysql-5.7.25-linux-glibc2.12-x86_64/bin/mysqld_safe --datadir=/mysql/data/mysql-5.7.25/data --pid-file=/mysql/data/mysql-5.7.25/data/mysqld.pid &
9.检查确认
cat /etc/my.cnf mysql -uroot -pmysql@2020
[root@mysql ~]# mysql -uroot -pmysql@2020
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.25 MySQL Community Server (GPL) Copyright (c) 2000, 2019, 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> SELECT table_schema,SUM(data_length+index_length)/1024/1024 AS total_mb,SUM(data_length)/1024/1024 AS data_mb,SUM(index_length)/1024/1024 AS index_mb, SUM(data_free)/1024/1024 AS free_mb,COUNT(*) AS tables_num,CURDATE() AS today FROM information_schema.tables where table_schema not in ('mysql','sys','information_schema','performance_schema') GROUP BY table_schema ORDER BY total_mb desc\G
*************************** 1. row ***************************
table_schema: app_manager
total_mb: 153.42434692
data_mb: 138.15676880
index_mb: 15.26757813
free_mb: 10.00000000
tables_num: 19
today: 2021-06-07
*************************** 2. row ***************************
table_schema: lifeapp_config
total_mb: 0.14376068
data_mb: 0.11055756
index_mb: 0.03320313
free_mb: 0.00000000
tables_num: 8
today: 2021-06-07
2 rows in set (0.01 sec)
总结:
1.升级前检查库的角色(主从),数据量的大小。数据量大可以采用这种方式,数据量小可以使用mysqldump进行导出导入。
2.升级重点就是执行新版本的初始化和upgrade脚本检查。
3.本次环境安装不标准,环境变量和my.cnf文件为聚堆全路径,所以需要修改这两项。规范安装应该建立软连接(ln -s mysql-5.7 /full_path ),无需进行修改。
MYSQL小版本升级(5.7.21至5.7.25)的更多相关文章
- 记一次mysql小版本升级
最近护网操作比较紧,基线和漏洞检查比较频繁,新扫描出来的mysql漏洞需要修复,没有啥好的修复方法,只剩下升级版本这一条路,生产环境是5.7.12,二进制文件直接解压使用的,看了一下现在最新的版本,5 ...
- 使用ThinkPHP开发中MySQL性能优化的最佳21条经验
使用ThinkPHP开发中MySQL性能优化的最佳21条经验讲解,目前,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更 ...
- mysql 5.6到percona 5.6小版本升级
假设原来是mysql 5.6.19社区版,现在要升级到percona server 5.6.30. 对于大的数据库来说,采用mysqldump方式进行迁移太花费时间了,可采用新安装加载原来数据库的方式 ...
- 【转】MySQL性能优化的最佳21条经验
文章转自: http://blog.csdn.net/waferleo/article/details/7179009 今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关 ...
- MySQL性能优化的最佳21条经验
今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序员需要去关注的事情.当我们去设计数据库表结构,对操作数据 ...
- MySQL性能优化的最佳21条经验【转载】
今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序员需要去关注的事情.当我们去设计数据库表结构,对操作数据 ...
- 平时一些mysql小技巧及常识
>navicat premium 快捷键1.ctrl+q 打开查询窗口2.ctrl+/ 注释sql语句3.ctrl+shift +/ 解除注释4.ctrl+r 运行查询窗口的sql语句5.ctr ...
- PHP之连接mysql小练习
mysql Test.sql 1 -- phpMyAdmin SQL Dump -- version 4.6.6 -- https://www.phpmyadmin.net/ -- -- Host: ...
- mysql小细节随笔
1, MySQL decimal(x,y) 存入根据y的下一位四舍五入,查了半天以为是laravel模型做了预处理,结果发现不是,是mysql decimal类型数据自动处理的,有好,也不好,合并订 ...
随机推荐
- PE分析
1 #include<windows.h> 2 #include<RichEdit.h> 3 #include "resource.h" 4 5 6 7 B ...
- Flink与Strom两个框架的对比分析
一.Flink与Storm两个框架的对比 二.Flink 的特性 1.高吞吐.低延迟.高性能 2.支持带事件的窗口(window) 操作:time.count.session.data-driven ...
- 理解ASP.NET Core - [01] Startup
注:本文隶属于<理解ASP.NET Core>系列文章,请查看置顶博客或点击此处查看全文目录 准备工作:一份ASP.NET Core Web API应用程序 当我们来到一个陌生的环境,第一 ...
- Mybatis原理和代码剖析
参考资料(官方) Mybatis官方文档: https://mybatis.org/mybatis-3/ Mybatis-Parent : https://github.com/mybatis/par ...
- SpringMVC笔记(2)
一.SpringMVC的数据响应 1.1 数据响应方式 1.1.1 页面跳转 直接返回字符串 将返回的字符串与内部资源视图解析器的前后缀拼接 进行访问(默认为转发) 通过ModelAndView对象返 ...
- JDK方法区、元空间区别 & String.intern相关面试题
一.方法区.永久代.元空间 1.方法区.永久代 方法区也是各个线程共享的内存区域,它用于存储已经被虚拟机加载的类信息.常量.静态变量.即时编译器编译后的代码等数据.方法区域又被称为"永久代& ...
- Appium问题解决方案(8)- selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate.
背景 运行时代码报错: selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occ ...
- Element NavMenu动态生成导航菜单
为了演示方便,不从数据库获取了 { "data":[ { "id":125, " ...
- Identity用户管理入门二(显示用户列表)
在Controllers中新建AccountController,并在构造方法(函数)中注入SignInManager,UserManager UserManager 用户管理(注册,查找,修改, ...
- JS021. 拦截事件的显式处理与默认动作(Web API: event.preventDefault)
Web API - event.preventDefault( ) Event 接口的 preventDefault( ) 方法,告诉 user agent :如果此事件没有被显式处理,它默认的动作 ...