Linux下Mysql的小版本升级

2 篇文章 0 订阅
1、查看当前 MySQL 版本
[root@icoolkj bin]# cd /usr/local/mysql/bin
[root@icoolkj bin]# ./mysql -V
./mysql  Ver 8.0.30 for Linux on x86_64 (MySQL Community Server - GPL)
2、 查看系统版本
[root@icoolkj bin]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.6.1810 (Core) 
Release:        7.6.1810
Codename:       Core

## 查看当前GBLIC版本,下载升级的mysql包需要关注,不然就需要升级GBLIC版本
[root@icoolkj support-files]# ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3、数据库备份(注意备份的完整)
使用 mysqldump 备份 MySQL
[root@icoolkj bin]# ./mysqldump -u root -p **** --all-databases > /home/data/bak/all.sql

## mysqldump -u [用户名] -p [密码] --all-databases > [备份文件名称].sql
## mysqldump -u [用户名] -p [密码] [数据库名称] [数据表名称] > [备份文件名称].sql
4、备份完成后,将mysql停掉
[root@icoolkj bin]# /etc/init.d/mysql stop
Shutting down MySQL...                                     [  确定  ]
[root@icoolkj bin]#
5、下载需要升级的mysql版本文件

Mysql下载地址
当前系统 mysql 版本为8.0.30 小版本升级为 8.0.36,GBLIC版本(2.17)
mysql-8.0.36-linux-glibc2.17-x86_64.tar.xz

6、将旧版的mysql目录备份打包
[root@icoolkj bin]# cd /usr/bin/
[root@icoolkj bin]# tar zcf mysql.tar.gz mysql
[root@icoolkj bin]# tar zcf mysqldump.tar.gz mysqldump
[root@icoolkj bin]# rm -rf mysql
[root@icoolkj bin]# rm -rf mysqldump

[root@icoolkj bin]# cd /usr/local/mysql/
[root@icoolkj mysql]# tar zcf bin_8.0.30.tar.gz bin
[root@icoolkj mysql]# rm -rf bin

[root@icoolkj mysql]# cd /etc/init.d/
[root@icoolkj init.d]# tar zcf mysql_8.0.30.tar.gz mysql
[root@icoolkj init.d]# rm -rf mysql
7、解压新的mysql包 
[root@icoolkj soft]# tar xf mysql-8.0.36-linux-glibc2.17-x86_64.tar
[root@icoolkj soft]# tar xf mysql-8.0.36-linux-glibc2.17-x86_64.tar.xz 
8、将新解压的mysql-8.0.36的bin目录复制到mysql早期目录下
[root@icoolkj soft]# cd /home/soft/mysql-8.0.36-linux-glibc2.17-x86_64
[root@icoolkj mysql-8.0.36-linux-glibc2.17-x86_64]# cp -r bin /usr/local/mysql/
[root@icoolkj mysql-8.0.36-linux-glibc2.17-x86_64]# ll /usr/local/mysql/
总用量 536812
drwxr-xr-x  2 root root       4096 1月  29 11:23 bin
drwxr-xr-x  2 7161 31415      4096 7月   7 2022 bin_8.0.30
-rw-r--r--  1 root root  549361146 1月  29 11:14 bin_8.0.30.tar.gz
drwxr-xr-x  2 7161 31415      4096 7月   7 2022 docs
drwxr-xr-x  3 7161 31415      4096 7月   7 2022 include
drwxr-xr-x  6 7161 31415      4096 7月   7 2022 lib
-rw-r--r--  1 7161 31415    287624 7月   7 2022 LICENSE
drwxr-xr-x  4 7161 31415      4096 7月   7 2022 man
-rw-r--r--  1 7161 31415       666 7月   7 2022 README
drwxr-xr-x 28 7161 31415      4096 7月   7 2022 share
drwxr-xr-x  2 7161 31415      4096 7月   7 2022 support-files

[root@icoolkj mysql-8.0.36-linux-glibc2.17-x86_64]#  cd /usr/local/mysql/bin
[root@icoolkj bin]# cp mysql /usr/bin 
[root@icoolkj bin]# cp mysqldump /usr/bin
[root@icoolkj bin]# cd /home/soft/mysql-8.0.36-linux-glibc2.17-x86_64

[root@icoolkj mysql-8.0.36-linux-glibc2.17-x86_64]# cp support-files/mysql.server /etc/init.d/mysql
[root@icoolkj mysql-8.0.36-linux-glibc2.17-x86_64]#
9、修改参数
## 对比早期版本,如果有修改则修改
##[root@icoolkj mysql-8.0.36-linux-glibc2.28-x86_64]#  cd /etc/init.d/
##[root@icoolkj init.d]# vi mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
10、启动mysql,查看升级后版本
[root@icoolkj bin]# /etc/init.d/mysql start
Starting MySQL.............                                [  确定  ]

[root@icoolkj bin]# ./mysql -V
./mysql  Ver 8.0.36 for Linux on x86_64 (MySQL Community Server - GPL)

 

 

 

  • 11
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值