【运维】Linux 离线升级指定版本的MariaDB 

目录

【运维】Linux 离线升级指定版本的MariaDB 

1.下载要更新的MariaDB 安装包

2.参考安装过程 解压安装包

3.进入解压的目录

4. 最后升级mariadb

5.查询当前mariadb版本是否是升级之后的版本


以Debian系统为例

1.下载要更新的MariaDB 安装包

Download MariaDB Products & Tools | MariaDB

wget https://dlm.mariadb.com/3895090/MariaDB/mariadb-11.5.2/repo/debian/mariadb-11.5.2-debian-bookworm-amd64-debs.tar

2.参考安装过程 解压安装包

tar -xvf mariadb-11.5.2-debian-bookworm-amd64-debs.tar

3.进入解压的目录

cd mariadb-11.5.2-debian-bookworm-amd64-debs/

执行

./setup_repository

注意:如果这里提示已存在则重命名该文件

[ERROR] File "/etc/apt/sources.list.d/mariadb.list" already exists. Rename it and re-run this script, or manually create a new .repo file.

重命名该文件  /etc/apt/sources.list.d/mariadb.list  改为 /etc/apt/sources.list.d/mariadb.listbak

或者删除该文件

然后接着执行

./setup_repository

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
Repository file successfully created! Please install MariaDB Server with this command:

   apt-get update && apt-get install mariadb-server

4. 最后升级mariadb

apt-get update && apt-get upgrade mariadb-server

或者升级全部

apt-get update && apt-get upgrade -y

注意:升级中途可能会遇到冲突的配置,根据实际情况进行选择 

Configuration file '/etc/mysql/mariadb.conf.d/50-server.cnf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** 50-server.cnf (Y/I/N/O/D/Z) [default=N] ?
  • Y 或 I:安装包维护者的版本。这将覆盖您所做的任何自定义设置。
  • N 或 O:保持当前安装的版本。这意味着您将保留自己所做的任何更改。
  • D:显示两个版本之间的差异。
  • Z:启动一个 shell 以便您可以更详细地检查情况。

建议先 D 查看差异情况, 根据差异情况选择操作   :q 可以退出查看

我这里用的N,保留了自己所作的更改

输入N 回车即可

5.查询当前mariadb版本是否是升级之后的版本

mariadb> SELECT VERSION();
+----------------------+
| VERSION()            |
+----------------------+
| 11.5.2-MariaDB-deb12 |
+----------------------+
1 row in set (0.07 sec)

mariadb>