MariaDB 简介
MariaDB Server 是一个通用的开源关系数据库管理系统。 它是世界上最受欢迎的数据库服务器之一,拥有包括 Wikipedia、WordPress.com 和 Google 在内的知名用户。 MariaDB Server 在 GPLv2 开源许可下发布,并保证保持开源。
它可用于高可用性事务数据、分析、作为嵌入式服务器,并且广泛的工具和应用程序支持 MariaDB Server。
mariadb&mysql
mariadb与mysql的区别有MariaDB不仅仅是Mysql的一个替代品,mysql已经被oracle闭源了而mariaDB是开源的,MariaDB包括的一些新特性使它优于MySQL。 MariaDB跟MySQL在绝大多数方面是兼容的,对于开发者来说,几乎感觉不到任何不同。Maria DB是一个采用Aria存储引擎的MySQL分支版本,而Mysql是最流行的关系型数据库管理系统,在WEB应用方面MySQL是最好的RDBMS应用软件之一。而且MariaDB是发展最快的MySQL分支版本,新版本发布速度已经超过了Oracle官方的MySQL版本。
系统:almalinux9
背景:当前系统下安装的是10.3.5版本自带的mariadb,不符合安装zabbix的需要,所以要升级到10.9(随便选了个版本)
卸载旧版本mariadb
dnf remove maria*
步骤1:官网获取repo信息
Download MariaDB Server - MariaDB.org
按照自己的系统选择,形成repo信息
在/etc/yum.repos.d/下 创建mariadb.repo文件,把下面内容复制进去
# 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
接着就是更新仓库缓存
dnf clean all
dnf makecache
步骤2:安装mariadb
dnf install MariaDB-server MariaDB-client
确认一下版本是否正确,正确后y安装
[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
完毕!
步骤3:启动数据库并查看状态
[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