Uninstall and upgrade to install mariadb 10.9 under almalinux (practical operation)

Introduction to MariaDB

       MariaDB Server is a general-purpose open source relational database management system. It is one of the most popular database servers in the world, with well-known users including  Wikipedia , WordPress.com  , and  Google  . MariaDB Server is released under the GPLv2 open source license and is guaranteed to remain open source.

It can be used for high-availability transactional data, analytics, as an embedded server, and a wide range of tools and applications support MariaDB Server.

mariadb&mysql


       The difference between mariadb and mysql is that MariaDB is not just a replacement for Mysql. Mysql has been closed source by Oracle, while mariaDB is open source. MariaDB includes some new features that make it superior to MySQL. MariaDB and MySQL are compatible in most aspects, and for developers, there is almost no difference. Maria DB is a branch version of MySQL using the Aria storage engine, and Mysql is the most popular relational database management system. MySQL is one of the best RDBMS application software in terms of WEB applications. Moreover, MariaDB is the fastest-growing MySQL branch version, and the release speed of new versions has exceeded Oracle's official MySQL version.
 

System: almalinux9

Background: The current system installed is mariadb that comes with version 10.3.5, which does not meet the needs of installing zabbix, so it needs to be upgraded to 10.9 (just choose a version)

Uninstall the old version of mariadb

dnf remove maria*

Step 1: Obtain repo information from the official website

Download MariaDB Server - MariaDB.org

Form repo information according to your own system selection

Create the mariadb.repo file under /etc/yum.repos.d/ and copy the following content into it

# MariaDB 10.9 CentOS repository list - created 2023-06-28 01:28 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/10.9/centos/$releasever/$basearch
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.9/centos/$releasever/$basearch
module_hotfixes = 1
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1

 The next step is to update the warehouse cache

dnf clean all
dnf makecache

Step 2: Install mariadb

dnf install MariaDB-server MariaDB-client

 Make sure the version is correct and install it after it is correct.

[root@localhost yum.repos.d]# dnf install MariaDB-server MariaDB-client
AlmaLinux 8 - BaseOS                                                                                                                                         781 kB/s | 3.9 MB     00:05    
AlmaLinux 8 - AppStream                                                                                                                                      1.0 MB/s |  11 MB     00:11    
AlmaLinux 8 - Extras                                                                                                                                          14 kB/s |  18 kB     00:01    
MariaDB                                                                                                                                                      265 kB/s | 620 kB     00:02    
Zabbix Official Repository - x86_64                                                                                                                           41 kB/s |  78 kB     00:01    
Zabbix Official Repository non-supported - x86_64                                                                                                            775  B/s | 1.2 kB     00:01    
依赖关系解决。
=============================================================================================================================================================================================
 软件包                                          架构                             版本                                                             仓库                                 大小
=============================================================================================================================================================================================
安装:
 MariaDB-client                                  x86_64                           10.9.7-1.el8                                                     mariadb                              15 M
 MariaDB-server                                  x86_64                           10.9.7-1.el8                                                     mariadb                              26 M
安装依赖关系:
 MariaDB-common                                  x86_64                           10.9.7-1.el8                                                     mariadb                              88 k
 MariaDB-shared                                  x86_64                           10.9.7-1.el8                                                     mariadb                             127 k
 boost-program-options                           x86_64                           1.66.0-13.el8                                                    appstream                           140 k
 galera-4                                        x86_64                           26.4.14-1.el8                                                    mariadb                              13 M
 libpmem                                         x86_64                           1.6.1-1.el8                                                      appstream                            79 k
 perl-DBI                                        x86_64                           1.641-4.module_el8.6.0+2823+173faa7e                             appstream                           739 k
 perl-Math-BigInt                                noarch                           1:1.9998.11-7.el8                                                baseos                              195 k
 perl-Math-Complex                               noarch                           1.59-422.el8.0.1                                                 baseos                              108 k
 socat                                           x86_64                           1.7.4.1-1.el8                                                    appstream                           322 k

事务概要
=============================================================================================================================================================================================
安装  11 软件包

总下载:56 M
安装大小:59 M
确定吗?[y/N]: y
下载软件包:
(1/11): perl-Math-Complex-1.59-422.el8.0.1.noarch.rpm                                                                                                        210 kB/s | 108 kB     00:00    
(2/11): boost-program-options-1.66.0-13.el8.x86_64.rpm                                                                                                       257 kB/s | 140 kB     00:00    
(3/11): perl-Math-BigInt-1.9998.11-7.el8.noarch.rpm                                                                                                          281 kB/s | 195 kB     00:00    
(4/11): libpmem-1.6.1-1.el8.x86_64.rpm                                                                                                                       389 kB/s |  79 kB     00:00    
(5/11): socat-1.7.4.1-1.el8.x86_64.rpm                                                                                                                       520 kB/s | 322 kB     00:00    
(6/11): perl-DBI-1.641-4.module_el8.6.0+2823+173faa7e.x86_64.rpm                                                                                             659 kB/s | 739 kB     00:01    
(7/11): MariaDB-common-10.9.7-1.el8.x86_64.rpm                                                                                                               192 kB/s |  88 kB     00:00    
(8/11): MariaDB-shared-10.9.7-1.el8.x86_64.rpm                                                                                                               333 kB/s | 127 kB     00:00    
(9/11): galera-4-26.4.14-1.el8.x86_64.rpm                                                                                                                    383 kB/s |  13 MB     00:35    
(10/11): MariaDB-client-10.9.7-1.el8.x86_64.rpm                                                                                                              385 kB/s |  15 MB     00:39    
(11/11): MariaDB-server-10.9.7-1.el8.x86_64.rpm                                                                                                              547 kB/s |  26 MB     00:48    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                         1.1 MB/s |  56 MB     00:52     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  运行脚本: MariaDB-shared-10.9.7-1.el8.x86_64                                                                                                                                           1/1 
  运行脚本: MariaDB-common-10.9.7-1.el8.x86_64                                                                                                                                           1/1 
  运行脚本: MariaDB-client-10.9.7-1.el8.x86_64                                                                                                                                           1/1 
  运行脚本: MariaDB-server-10.9.7-1.el8.x86_64                                                                                                                                           1/1 
  准备中  :                                                                                                                                                                              1/1 
  运行脚本: MariaDB-shared-10.9.7-1.el8.x86_64                                                                                                                                          1/11 
  安装    : MariaDB-shared-10.9.7-1.el8.x86_64                                                                                                                                          1/11 
  运行脚本: MariaDB-shared-10.9.7-1.el8.x86_64                                                                                                                                          1/11 
  运行脚本: MariaDB-common-10.9.7-1.el8.x86_64                                                                                                                                          2/11 
  安装    : MariaDB-common-10.9.7-1.el8.x86_64                                                                                                                                          2/11 
  运行脚本: MariaDB-common-10.9.7-1.el8.x86_64                                                                                                                                          2/11 
  安装    : libpmem-1.6.1-1.el8.x86_64                                                                                                                                                  3/11 
  运行脚本: libpmem-1.6.1-1.el8.x86_64                                                                                                                                                  3/11 
  安装    : socat-1.7.4.1-1.el8.x86_64                                                                                                                                                  4/11 
  安装    : boost-program-options-1.66.0-13.el8.x86_64                                                                                                                                  5/11 
  运行脚本: boost-program-options-1.66.0-13.el8.x86_64                                                                                                                                  5/11 
  运行脚本: galera-4-26.4.14-1.el8.x86_64                                                                                                                                               6/11 
  安装    : galera-4-26.4.14-1.el8.x86_64                                                                                                                                               6/11 
  运行脚本: galera-4-26.4.14-1.el8.x86_64                                                                                                                                               6/11 
  安装    : perl-Math-Complex-1.59-422.el8.0.1.noarch                                                                                                                                   7/11 
  安装    : perl-Math-BigInt-1:1.9998.11-7.el8.noarch                                                                                                                                   8/11 
  安装    : perl-DBI-1.641-4.module_el8.6.0+2823+173faa7e.x86_64                                                                                                                        9/11 
  运行脚本: MariaDB-client-10.9.7-1.el8.x86_64                                                                                                                                         10/11 
  安装    : MariaDB-client-10.9.7-1.el8.x86_64                                                                                                                                         10/11 
  运行脚本: MariaDB-client-10.9.7-1.el8.x86_64                                                                                                                                         10/11 
  运行脚本: MariaDB-server-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  安装    : MariaDB-server-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  运行脚本: MariaDB-server-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  运行脚本: MariaDB-shared-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  运行脚本: MariaDB-common-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  运行脚本: MariaDB-client-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  运行脚本: MariaDB-server-10.9.7-1.el8.x86_64                                                                                                                                         11/11 
  验证    : perl-Math-BigInt-1:1.9998.11-7.el8.noarch                                                                                                                                   1/11 
  验证    : perl-Math-Complex-1.59-422.el8.0.1.noarch                                                                                                                                   2/11 
  验证    : boost-program-options-1.66.0-13.el8.x86_64                                                                                                                                  3/11 
  验证    : libpmem-1.6.1-1.el8.x86_64                                                                                                                                                  4/11 
  验证    : perl-DBI-1.641-4.module_el8.6.0+2823+173faa7e.x86_64                                                                                                                        5/11 
  验证    : socat-1.7.4.1-1.el8.x86_64                                                                                                                                                  6/11 
  验证    : MariaDB-client-10.9.7-1.el8.x86_64                                                                                                                                          7/11 
  验证    : MariaDB-common-10.9.7-1.el8.x86_64                                                                                                                                          8/11 
  验证    : MariaDB-server-10.9.7-1.el8.x86_64                                                                                                                                          9/11 
  验证    : MariaDB-shared-10.9.7-1.el8.x86_64                                                                                                                                         10/11 
  验证    : galera-4-26.4.14-1.el8.x86_64                                                                                                                                              11/11 

已安装:
  MariaDB-client-10.9.7-1.el8.x86_64            MariaDB-common-10.9.7-1.el8.x86_64           MariaDB-server-10.9.7-1.el8.x86_64    MariaDB-shared-10.9.7-1.el8.x86_64                     
  boost-program-options-1.66.0-13.el8.x86_64    galera-4-26.4.14-1.el8.x86_64                libpmem-1.6.1-1.el8.x86_64            perl-DBI-1.641-4.module_el8.6.0+2823+173faa7e.x86_64   
  perl-Math-BigInt-1:1.9998.11-7.el8.noarch     perl-Math-Complex-1.59-422.el8.0.1.noarch    socat-1.7.4.1-1.el8.x86_64           

完毕!

Step 3: Start the database and view the status

[root@localhost yum.repos.d]# systemctl start mariadb
[root@localhost yum.repos.d]# systemctl status mariadb
● mariadb.service - MariaDB 10.9.7 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Tue 2023-06-27 21:32:53 EDT; 7s ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 3149 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 3114 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_ST>
  Process: 3112 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 3125 (mariadbd)
   Status: "Taking your SQL requests now..."
    Tasks: 24 (limit: 102266)
   Memory: 222.1M
   CGroup: /system.slice/mariadb.service
           └─3125 /usr/sbin/mariadbd

6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [Note] Plugin 'FEEDBACK' is disabled.
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [Note] Server socket created on IP: '0.0.0.0'.
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [Note] Server socket created on IP: '::'.
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [ERROR] Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type varchar(, found type>
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [ERROR] mariadbd: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [Note] /usr/sbin/mariadbd: ready for connections.
6月 27 21:32:53 localhost mariadbd[3125]: Version: '10.9.7-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
6月 27 21:32:53 localhost systemd[1]: Started MariaDB 10.9.7 database server.
6月 27 21:32:53 localhost mariadbd[3125]: 2023-06-27 21:32:53 0 [Note] InnoDB: Buffer pool(s) load completed at 230627 21:32:53

Guess you like

Origin blog.csdn.net/weixin_42517271/article/details/131430447