首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >MariaDB二进制包安装

MariaDB二进制包安装

原创
作者头像
Raymond运维
修改2025-09-30 10:58:42
修改2025-09-30 10:58:42
1410
举报
文章被收录于专栏:干货分享干货分享

2.3 二进制安装MariaDB

2.3.1 用户和组

代码语言:javascript
复制
1# Rocky、Almalinux、CentOS、openEuler、AnolisOS、OpenCloudOS、 Kylin Server、UOS Server、Ubuntu、Debian
2useradd-r-s /sbin/nologin -d /data/mariadb mysql
3
4# openSUSE
5groupadd-r mysql
6useradd-s /sbin/nologin -d /data/mariadb -r-g mysql mysql

2.3.2 准备程序文件

MariaDB二进制包下载,去“https://mariadb.org”网站下载,选择“Download”。

t8
t8

图8 MariaDB首页

在打开的网页,在“MariaDB Server”下面选择“MariaDB Server Version为:MariaDB Server 11.8.2”,选择“Operating System为:Linux”,选择“Architecture为:x86_64”,选择"Init System为:Systemd",然后选择“Mirror为:清华大学 TUNA 协会 (Tsinghua University TUNA Association)”,最后选择“Download”下载。

t9
t9

图9 MariaDB二进制包下载

代码语言:javascript
复制
1# Rocky、Almalinux、CentOS、AnolisOS、OpenCloudOS、Kylin Server默认没有wget包,需要安装
2yum install-ywget
3
4# openEuler 22.03/24.03 LTS、AnolisOS 23、OpenCloudOS 9没有安装tar包,需要安装
5yum install-ytar
6
7# Rocky 8/9/10、Almalinux 8/9/10、CentOS Stream 8/9/10、openEuler 22.03/24.03 LTS、AnolisOS 8/23、OpenCloudOS 8/9、Kylin Server v10/v11、UOS Server v20、openSUSE 15、Ubuntu Server 18.04/20.04/22.04/24.04 LTS、Debian 11/12/13:
8wget https://mirrors.tuna.tsinghua.edu.cn/mariadb///mariadb-11.8.3/bintar-linux-systemd-x86_64/mariadb-11.8.3-linux-systemd-x86_64.tar.gz
9tar xf mariadb-11.8.3-linux-systemd-x86_64.tar.gz -C /usr/local
10ln-s /usr/local/mariadb-11.8.3-linux-systemd-x86_64/ /usr/local/mysql
11
12# CentOS 7
13wget https://mirrors.tuna.tsinghua.edu.cn/mariadb///mariadb-11.4.8/bintar-linux-systemd-x86_64/mariadb-11.4.8-linux-systemd-x86_64.tar.gz
14tar xf mariadb-11.4.8-linux-systemd-x86_64.tar.gz -C /usr/local
15ln-s /usr/local/mariadb-11.4.8-linux-systemd-x86_64/ /usr/local/mysql
16
17chown-R  mysql:mysql /usr/local/mysql/

2.3.3 准备环境变量

代码语言:javascript
复制
1echo'PATH=/usr/local/mysql/bin/:$PATH'> /etc/profile.d/mariadb.sh
2. /etc/profile.d/mariadb.sh

2.3.4 准备配置文件

代码语言:javascript
复制
1cat> /etc/my.cnf <<-EOF
2[mariadb]
3datadir=/data/mariadb
4socket=/data/mariadb/mariadb.sock
5log-error=/data/mariadb/mariadb.log
6pid-file=/data/mariadb/mariadb.pid
7
8[client]
9socket=/data/mariadb/mariadb.sock
10EOF

2.3.5 生成数据库文件

代码语言:javascript
复制
1mkdir-p /data/mariadb
2
3chown-R  mysql:mysql /data/mariadb
4
5# 这里必须先要进入/usr/local/mysql/目录,在执行下面命令
6cd /usr/local/mysql/

Rocky 10、AlmaLinux 10和CentOS Stream 10:

代码语言:javascript
复制
1[root@rocky10 mysql]# ./scripts/mariadb-install-db --datadir=/data/mariadb/ --user=mysql
2Installing MariaDB/MySQL system tables in'/data/mariadb/'...
3./bin/mariadbd: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory # 提示,加载共享库时出错:libcrypt.so.1:无法打开共享对象文件:没有这样的文件或目录
4
5Installation of system tables failed!  Examine the logs in
6/data/mariadb/ formore information.
7
8The problem could be conflicting information in an external
9my.cnf files. You can ignore these by doing:
10
11    shell> ./scripts/mariadb-install-db --defaults-file=~/.my.cnf
12
13You can also try to start the mariadbd daemon with:
14
15    shell> ./bin/mariadbd --skip-grant-tables --general-log &
16
17and use the command line tool ./bin/mariadb
18to connect to the mysql database and look at the grant tables:
19
20    shell> ./bin/mariadb -u root mysql
21    MariaDB> show tables;
22
23Try './bin/mariadbd --help'if you have problems with paths.  Using
24--general-log gives you a log in /data/mariadb/ that may be helpful.
25
26The latest information about mariadb-install-db is available at
27https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
28You can find the latest source at https://downloads.mariadb.org and
29the MariaDB discuss email list at https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/
30
31Please check all of the above before submitting a bug report
32at https://mariadb.org/jira
33
34# 安装libxcrypt-compat包
35yum install-y libxcrypt-compat
36
37[root@rocky10 mysql]# ./scripts/mariadb-install-db --datadir=/data/mariadb/ --user=mysql
38Installing MariaDB/MySQL system tables in'/data/mariadb/'...
39OK
40
41To start mariadbd at boot time you have to copy
42support-files/mariadb.service to the right place for your system
43
44
45Two all-privilege accounts were created.
46One is root@localhost, it has no password, but you need to
47be system 'root' user to connect. Use, for example, sudo mariadb
48The second is mysql@localhost, it has no password either, but
49you need to be the system 'mysql' user to connect.
50After connecting you can set the password, if you would need to be
51able to connect as any of these users with a password and without sudo
52
53See the MariaDB Knowledgebase at https://mariadb.com/kb
54
55You can start the MariaDB daemon with:
56cd'.'; ./bin/mariadbd-safe --datadir='/data/mariadb/'
57
58You can test the MariaDB daemon with mariadb-test-run.pl
59cd'./mariadb-test'; perl mariadb-test-run.pl
60
61Please report any problems at https://mariadb.org/jira
62
63The latest information about MariaDB is available at https://mariadb.org/.
64
65Consider joining MariaDB's strong and vibrant community:
66https://mariadb.org/get-involved/

Rocky 8/9、Almalinux 8/9、CentOS Stream 8/9、CentOS 7、openEuler 22.03/24.03 LTS、AnolisOS 8/23、OpenCloudOS 8/9、Kylin Server v10/v11、UOS Server v20、openSUSE 15、Ubuntu Server 18.04/20.04/22.04/24.04 LTS、Debian 11/12/13:

代码语言:javascript
复制
1[root@rocky9 mysql]# ./scripts/mariadb-install-db --datadir=/data/mariadb/ --user=mysql
2Installing MariaDB/MySQL system tables in'/data/mariadb/'...
3OK
4
5To start mariadbd at boot time you have to copy
6support-files/mariadb.service to the right place for your system
7
8
9Two all-privilege accounts were created.
10One is root@localhost, it has no password, but you need to
11be system 'root' user to connect. Use, for example, sudo mariadb
12The second is mysql@localhost, it has no password either, but
13you need to be the system 'mysql' user to connect.
14After connecting you can set the password, if you would need to be
15able to connect as any of these users with a password and without sudo
16
17See the MariaDB Knowledgebase at https://mariadb.com/kb
18
19You can start the MariaDB daemon with:
20cd'.'; ./bin/mariadbd-safe --datadir='/data/mariadb/'
21
22You can test the MariaDB daemon with mariadb-test-run.pl
23cd'./mariadb-test'; perl mariadb-test-run.pl
24
25Please report any problems at https://mariadb.org/jira
26
27The latest information about MariaDB is available at https://mariadb.org/.
28
29Consider joining MariaDB's strong and vibrant community:
30https://mariadb.org/get-involved/

2.3.6 准备服务脚本和启动

代码语言:javascript
复制
1# Rocky、Almalinux、CentOS、openEuler、AnolisOS、OpenCloudOS、Kylin Server、UOS Server、openSUSE:
2cp /usr/local/mysql/support-files/systemd/mariadb.service /usr/lib/systemd/system/
3
4
5# Ubuntu和Debian:
6cp /usr/local/mysql/support-files/systemd/mariadb.service /lib/systemd/system/
7
8systemctl daemon-reload && systemctl enable--now mariadb
9
10[root@rocky10 mysql]# ls /data/mariadb/
11aria_log.00000001  ib_buffer_pool  ibtmp1                multi-master.info   rocky10.pid  test     undo003
12aria_log_control   ibdata1         mariadb.sock          mysql               sys          undo001
13ddl_recovery.log   ib_logfile0     mariadb_upgrade_info  performance_schema  tc.log       undo002
14
15[root@rocky10 mariadb]# mariadb -V
16mariadb from 11.8.3-MariaDB, client 15.2for linux-systemd (x86_64) using readline 5.1
17
18[root@centos7 mariadb]# mariadb -V
19mariadb from 11.4.8-MariaDB, client 15.2for linux-systemd (x86_64) using readline 5.1

2.3.7 安全初始化

代码语言:javascript
复制
1[root@rocky10 mysql]# mariadb
2Welcome to the MariaDB monitor.  Commands end with ; or \g.
3Your MariaDB connection id is 3
4Server version: 11.8.3-MariaDB MariaDB Server
5
6Copyright (c)2000, 2018, Oracle, MariaDB Corporation Ab and others.
7
8Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
9
10MariaDB [(none)]> status
11--------------
12mariadb from 11.8.3-MariaDB, client 15.2for linux-systemd (x86_64) using readline 5.1
13
14Connection id:		3
15Current database:	
16Current user:		root@localhost
17SSL:			Cipher in use is TLS_AES_256_GCM_SHA384, cert is OK
18Current pager:		stdout
19Using outfile:		''
20Using delimiter:	;
21Server:			MariaDB
22Server version:		11.8.3-MariaDB MariaDB Server
23Protocol version:	10
24Connection:		Localhost via UNIX socket
25Server characterset:	utf8mb4
26Db     characterset:	utf8mb4
27Client characterset:	utf8mb4
28Conn.  characterset:	utf8mb4
29UNIX socket:		/data/mariadb/mariadb.sock
30Uptime:			32 sec
31
32Threads: 1  Questions: 4  Slow queries: 0  Opens: 17  Open tables: 10  Queries per second avg: 0.125
33--------------
34
35MariaDB [(none)]> show databases;
36+--------------------+
37| Database           |
38+--------------------+
39| information_schema |
40| mysql              |
41| performance_schema |
42| sys                |
43|test|# 有test数据库
44+--------------------+
455 rows inset(0.001 sec)
46
47MariaDB [(none)]>select user,host from mysql.user;
48+-------------+-----------+
49| User        | Host      |
50+-------------+-----------+
51| PUBLIC      ||
52|| localhost |# 有匿名用户 
53| mariadb.sys | localhost |
54| mysql       | localhost |
55| root        | localhost |
56|| rocky10   |# 有远程登录用户 
57+-------------+-----------+
586 rows inset(0.001 sec)
59
60MariaDB [(none)]>exit
61Bye
62
63# 有test数据库、匿名用户和远程登录用户,需要安全初始化
64[root@rocky10 mariadb]# mariadb-secure-installation
65
66NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
67      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
68
69In order to log into MariaDB to secure it, we'll need the current
70password for the root user. If you've just installed MariaDB, and
71haven't set the root password yet, you should just press enter here.
72
73Enter current password for root (enter for none):  # 输入 root 的当前密码(不输入),直接敲回车
74ERROR 2002(HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2)# 提示没有“/tmp/mysql.sock”文件
75
76# 创建软链接
77[root@rocky10 mariadb]# ln -s /data/mariadb/mariadb.sock /tmp/mysql.sock
78
79[root@rocky10 mysql]# mariadb-secure-installation
80
81NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
82      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
83
84In order to log into MariaDB to secure it, we'll need the current
85password for the root user. If you've just installed MariaDB, and
86haven't set the root password yet, you should just press enter here.
87
88Enter current password for root (enter for none):  # 输入 root 的当前密码(不输入),直接敲回车
89OK, successfully used password, moving on...
90
91Setting the root password or using the unix_socket ensures that nobody
92can log into the MariaDB root user without the proper authorisation.
93
94You already have your root account protected, so you can safely answer 'n'.
95
96Switch to unix_socket authentication [Y/n] y # 输入y,切换到 unix_socket 身份验证
97Enabled successfully!
98Reloading privilege tables..
99... Success!
100
101
102You already have your root account protected, so you can safely answer 'n'.
103
104Change the root password? [Y/n] n # 输入n,不设置root密码
105... skipping.
106
107By default, a MariaDB installation has an anonymous user, allowing anyone
108to log into MariaDB without having to have a user account created for
109them.  This is intended only for testing, and to make the installation
110go a bit smoother.  You should remove them before moving into a
111production environment.
112
113Remove anonymous users? [Y/n] y # 输入y,移除匿名账户
114... Success!
115
116Normally, root should only be allowed to connect from 'localhost'.  This
117ensures that someone cannot guess at the root password from the network.
118
119Disallow root login remotely? [Y/n] y # 输入y,禁止 root 远程登录
120... Success!
121
122By default, MariaDB comes with a database named 'test' that anyone can
123access.  This is also intended only for testing, and should be removed
124before moving into a production environment.
125
126Remove test database and access to it? [Y/n] y # 输入y,移除测试库
127 - Dropping test database...
128... Success!
129 - Removing privileges on test database...
130... Success!
131
132Reloading the privilege tables will ensure that all changes made so far
133will take effect immediately.
134
135Reload privilege tables now? [Y/n] y # 输入y,重新加载权限表
136... Success!
137
138Cleaning up...
139
140All done!  If you've completed all of the above steps, your MariaDB
141installation should now be secure.
142
143Thanks for using MariaDB!

2.3.8 测试登录

代码语言:javascript
复制
1[root@rocky10 mysql]# mariadb
2Welcome to the MariaDB monitor.  Commands end with ; or \g.
3Your MariaDB connection id is 22
4Server version: 11.8.3-MariaDB MariaDB Server
5
6Copyright (c)2000, 2018, Oracle, MariaDB Corporation Ab and others.
7
8Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
9
10MariaDB [(none)]> status
11--------------
12mariadb from 11.8.3-MariaDB, client 15.2for linux-systemd (x86_64) using readline 5.1
13
14Connection id:		22
15Current database:	
16Current user:		root@localhost
17SSL:			Cipher in use is TLS_AES_256_GCM_SHA384, cert is OK
18Current pager:		stdout
19Using outfile:		''
20Using delimiter:	;
21Server:			MariaDB
22Server version:		11.8.3-MariaDB MariaDB Server
23Protocol version:	10
24Connection:		Localhost via UNIX socket
25Server characterset:	utf8mb4
26Db     characterset:	utf8mb4
27Client characterset:	utf8mb4
28Conn.  characterset:	utf8mb4
29UNIX socket:		/data/mariadb/mariadb.sock
30Uptime:			2 min 52 sec
31
32Threads: 1  Questions: 46  Slow queries: 0  Opens: 18  Open tables: 11  Queries per second avg: 0.267
33--------------
34
35MariaDB [(none)]> show databases;
36+--------------------+
37| Database           |
38+--------------------+
39| information_schema |
40| mysql              |
41| performance_schema |
42| sys                |
43+--------------------+
444 rows inset(0.001 sec)
45# 没有test数据库
46
47MariaDB [(none)]>select user,host from mysql.user;
48+-------------+-----------+
49| User        | Host      |
50+-------------+-----------+
51| PUBLIC      ||
52| mariadb.sys | localhost |
53| mysql       | localhost |
54| root        | localhost |
55+-------------+-----------+
564 rows inset(0.001 sec)
57# 没有匿名用户和远程登录用户
58
59MariaDB [(none)]>exit
60Bye

2.3.9 一键安装MariaDB二进制包的脚本

Shell脚本源码地址:

Gitee:https://gitee.com/raymond9/shell

Github:https://github.com/raymond999999/shell

可以去上面的Gitee或Github代码仓库拉取脚本。

代码语言:javascript
复制
1[root@rocky10 ~]# cat install_mariadb_binary_v2.sh
2#!/bin/bash
3#
4#**********************************************************************************
5#Author:        Raymond
6#QQ:            88563128
7#MP:            Raymond运维
8#Date:          2025-09-22
9#FileName:      install_mariadb_binary_v2.sh
10#URL:           https://wx.zsxq.com/group/15555885545422
11#Description:   The mariadb binary script install supports 
12#               “Rocky Linux 8, 9 and 10, AlmaLinux 8, 9 and 10, CentOS 7, 
13#               CentOS Stream 8, 9 and 10, openEuler 22.03 and 24.03 LTS, 
14#               AnolisOS 8 and 23, OpenCloudOS 8 and 9, Kylin Server v10 and v11, 
15#               UOS Server v20, Ubuntu Server 18.04, 20.04, 22.04 and 24.04 LTS,  
16#               Debian 11 , 12 and 13, openSUSE Leap 15“ operating systems.
17#Copyright (C): 2025 All rights reserved
18#**********************************************************************************
19COLOR="echo -e \\033[01;31m"
20END='\033[0m'
21
22os(){
23. /etc/os-release
24MAIN_NAME=`sed-rn'/^NAME=/s@.*="([[:alpha:]]+).*"$@\1@p' /etc/os-release`
25if[${MAIN_NAME}=="Kylin"];then
26MAIN_VERSION_ID=`sed-rn'/^VERSION_ID=/s@.*="([[:alpha:]]+)(.*)"$@\2@p' /etc/os-release`
27else
28MAIN_VERSION_ID=`sed-rn'/^VERSION_ID=/s@.*="?([0-9]+)\.?.*"?@\1@p' /etc/os-release`
29fi
30if[${MAIN_NAME}=="Ubuntu"-o${MAIN_NAME}=="Debian"];then
31FULL_NAME="${PRETTY_NAME}"
32elif[${MAIN_NAME}=="UOS"];then
33FULL_NAME="${NAME}"
34else
35FULL_NAME="${NAME}${VERSION_ID}"
36fi
37}
38
39os
40DATA_DIR=/data/mariadb
41
42# mariadb 11.8.3包下载地址:"https://mirrors.tuna.tsinghua.edu.cn/mariadb///mariadb-11.8.3/bintar-linux-systemd-x86_64/mariadb-11.8.3-linux-systemd-x86_64.tar.gz"
43# mariadb 11.4.8包下载地址:"https://mirrors.tuna.tsinghua.edu.cn/mariadb///mariadb-11.4.8/bintar-linux-systemd-x86_64/mariadb-11.4.8-linux-systemd-x86_64.tar.gz"
44
45if[${MAIN_NAME}=="CentOS"-a${MAIN_VERSION_ID}==7];then
46MARIADB_VERSION=11.4.8
47else
48MARIADB_VERSION=11.8.3
49fi
50MARIADB_URL="https://mirrors.tuna.tsinghua.edu.cn/mariadb///mariadb-${MARIADB_VERSION}/bintar-linux-systemd-x86_64/"
51MARIADB_FILE="mariadb-${MARIADB_VERSION}-linux-systemd-x86_64.tar.gz"
52
53check_file(){
54if[${MAIN_NAME}=="Rocky"-o${MAIN_NAME}=="AlmaLinux"-o${MAIN_NAME}=="CentOS"-o${MAIN_NAME}=="Anolis"-o${MAIN_NAME}=="OpenCloudOS"-o${MAIN_NAME}=="Kylin"];then
55rpm-qwget&> /dev/null ||{${COLOR}"安装wget工具,请稍等......"${END};yum install-ywget&> /dev/null;}
56fi
57if[!-e${MARIADB_FILE}];then
58${COLOR}"缺少${MARIADB_FILE}文件。"${END}
59${COLOR}'开始下载MariaDB二进制安装包,请稍等......'${END}
60wget${MARIADB_URL}${MARIADB_FILE}||{${COLOR}"MariaDB二进制安装包下载失败。"${END};exit;}
61else
62${COLOR}"${MARIADB_FILE}文件已准备好。"${END}
63fi
64}
65
66install_mariadb(){
67[-d /usr/local/mysql ]&&{${COLOR}"MariaDB数据库已存在,安装失败!"${END};exit;}
68${COLOR}"开始安装MariaDB数据库,请稍等......"${END}
69if[${MAIN_NAME}=="openSUSE"];then
70id mysql &> /dev/null ||{groupadd-r mysql &&useradd-s /sbin/nologin -d${DATA_DIR}-r-g mysql mysql;${COLOR}"成功创建mysql用户!"${END};}
71else
72id mysql &> /dev/null ||{useradd-r-s /sbin/nologin -d${DATA_DIR} mysql ;${COLOR}"成功创建mysql用户!"${END};}
73fi
74if[${MAIN_NAME}=="openEuler"];then
75if[${MAIN_VERSION_ID}==22-o${MAIN_VERSION_ID}==24];then
76            yum install-ytar&> /dev/null
77fi
78fi
79if[${MAIN_NAME}=="Anolis"];then
80if[${MAIN_VERSION_ID}==23];then
81            yum install-ytar&> /dev/null
82fi
83fi
84if[${MAIN_NAME}=="OpenCloudOS"];then
85if[${MAIN_VERSION_ID}==9];then
86            yum install-ytar&> /dev/null
87fi
88fi
89tar xf ${MARIADB_FILE}-C /usr/local/
90MARIADB_DIR=`echo ${MARIADB_FILE}|sed-nr's/^(.*[0-9]).*/\1/p'`
91ln-s  /usr/local/${MARIADB_DIR} /usr/local/mysql
92chown-R mysql:mysql /usr/local/mysql/
93echo'PATH=/usr/local/mysql/bin/:$PATH'> /etc/profile.d/mariadb.sh
94. /etc/profile.d/mariadb.sh
95cat> /etc/my.cnf <<-EOF
96[mariadb]
97datadir=${DATA_DIR}
98socket=${DATA_DIR}/mariadb.sock
99log-error=${DATA_DIR}/mariadb.log
100pid-file=${DATA_DIR}/mariadb.pid
101
102[client]
103socket=${DATA_DIR}/mariadb.sock
104EOF
105[-d${DATA_DIR}]||mkdir-p${DATA_DIR}&> /dev/null
106chown-R mysql:mysql ${DATA_DIR}
107if[${MAIN_NAME}=="Rocky"];then
108if[${MAIN_VERSION_ID}==10];then
109            yum install-y libxcrypt-compat &> /dev/null
110fi
111fi
112if[${MAIN_NAME}=="AlmaLinux"];then
113if[${MAIN_VERSION_ID}==10];then
114            yum install-y libxcrypt-compat &> /dev/null
115fi
116fi
117if[${MAIN_NAME}=="CentOS"];then
118if[${MAIN_VERSION_ID}==10];then
119            yum install-y libxcrypt-compat &> /dev/null
120fi
121fi
122cd /usr/local/mysql
123    ./scripts/mysql_install_db --datadir=${DATA_DIR}--user=mysql
124if[${MAIN_NAME}=="Ubuntu"-o${MAIN_NAME}=="Debian"];then
125cp /usr/local/mysql/support-files/systemd/mariadb.service /lib/systemd/system/
126else
127cp /usr/local/mysql/support-files/systemd/mariadb.service /usr/lib/systemd/system/
128fi
129    systemctl daemon-reload && systemctl enable--now mariadb &> /dev/null
130[$?-ne0]&&{${COLOR}"数据库启动失败,退出!"${END};exit;}
131}
132
133mariadb_secure(){
134ln-s${DATA_DIR}/mariadb.sock /tmp/mysql.sock
135    /usr/local/mysql/bin/mariadb-secure-installation <<EOF
136
137y
138n
139y
140y
141y
142y
143EOF
144${COLOR}"${FULL_NAME}操作系统,MariaDB数据库安装完成!"${END}
145}
146
147main(){
148    check_file
149    install_mariadb
150    mariadb_secure
151}
152
153if[${MAIN_NAME}=="Rocky"];then
154if[${MAIN_VERSION_ID}==8-o${MAIN_VERSION_ID}==9-o${MAIN_VERSION_ID}==10];then
155        main
156fi
157elif[${MAIN_NAME}=="AlmaLinux"];then
158if[${MAIN_VERSION_ID}==8-o${MAIN_VERSION_ID}==9-o${MAIN_VERSION_ID}==10];then
159        main
160fi
161elif[${MAIN_NAME}=="CentOS"];then
162if[${MAIN_VERSION_ID}==7-o${MAIN_VERSION_ID}==8-o${MAIN_VERSION_ID}==9-o${MAIN_VERSION_ID}==10];then
163        main
164fi
165elif[${MAIN_NAME}=="openEuler"];then
166if[${MAIN_VERSION_ID}==22-o${MAIN_VERSION_ID}==24];then
167        main
168fi
169elif[${MAIN_NAME}=="Anolis"];then
170if[${MAIN_VERSION_ID}==8-o${MAIN_VERSION_ID}==23];then
171        main
172fi
173elif[${MAIN_NAME}=='OpenCloudOS'];then
174if[${MAIN_VERSION_ID}==8-o${MAIN_VERSION_ID}==9];then
175        main
176fi
177elif[${MAIN_NAME}=="Kylin"];then
178if[${MAIN_VERSION_ID}==10-o${MAIN_VERSION_ID}==11];then
179        main
180fi
181elif[${MAIN_NAME}=="UOS"];then
182if[${MAIN_VERSION_ID}==20];then
183        main
184fi
185elif[${MAIN_NAME}=="openSUSE"];then
186if[${MAIN_VERSION_ID}==15];then
187        main
188fi
189elif[${MAIN_NAME}=="Ubuntu"];then
190if[${MAIN_VERSION_ID}==18-o${MAIN_VERSION_ID}==20-o${MAIN_VERSION_ID}==22-o${MAIN_VERSION_ID}==24];then
191        main
192fi
193elif[${MAIN_NAME}=='Debian'];then
194if[${MAIN_VERSION_ID}==11-o${MAIN_VERSION_ID}==12-o${MAIN_VERSION_ID}==13];then
195        main
196fi
197else
198${COLOR}"此脚本不支持${FULL_NAME}操作系统!"${END}
199fi

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 2.3 二进制安装MariaDB
    • 2.3.1 用户和组
    • 2.3.2 准备程序文件
    • 2.3.3 准备环境变量
    • 2.3.4 准备配置文件
    • 2.3.5 生成数据库文件
    • 2.3.6 准备服务脚本和启动
    • 2.3.7 安全初始化
    • 2.3.8 测试登录
    • 2.3.9 一键安装MariaDB二进制包的脚本
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档