Repository navigation
Expand file tree
/
Copy pathmariadb-install.sh
More file actions
executable file
·55 lines (46 loc) · 2.17 KB
/
Copy pathmariadb-install.sh
File metadata and controls
executable file
·55 lines (46 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Copyright:: Copyright (c) 2016 Been Kyung-yoon (http://www.php79.com/)
# License:: The MIT License (MIT)
STACK_ROOT=$( dirname $( cd "$( dirname "$0" )" && pwd ) )
source "${STACK_ROOT}/includes/function.inc.sh"
if [[ "$OS" = "centos7" || "$OS" = "rocky8" ]]; then
title "MariaDB ${MARIADB_VERSION} 을 설치합니다."
else
title "MariaDB 10.6 을 설치합니다."
fi
yum_install MariaDB-server MariaDB-client MariaDB-common MariaDB-compat MariaDB-shared
# 메모리 선택 -> MariaDB 10.3 부터 미지원
#if [ ${1} = "4G" ]; then
# if [ ! -f /etc/my.cnf.d/my-innodb-heavy-4G.cnf ]; then
# notice "MariaDB 메모리 사용량이 4GB 로 최적화되었습니다.\n설정 파일 경로) /usr/share/mysql/my-innodb-heavy-4G.cnf"
# cp -av /usr/share/mysql/my-innodb-heavy-4G.cnf /etc/my.cnf.d/
# fi
#fi
#if [ ${1} = "2G" ]; then
# if [ ! -f /etc/my.cnf.d/my-huge.cnf ]; then
# notice "MariaDB 메모리 사용량이 2GB 로 최적화되었습니다.\n설정 파일 경로) /usr/share/mysql/my-huge.cnf"
# cp -av /usr/share/mysql/my-huge.cnf /etc/my.cnf.d/
# fi
#fi
#if [ ${1} = "512M" ]; then
# if [ ! -f /etc/my.cnf.d/my-large.cnf ]; then
# notice "MariaDB 메모리 사용량이 512MB 로 최적화되었습니다.\n설정 파일 경로) /usr/share/mysql/my-large.cnf"
# cp -av /usr/share/mysql/my-large.cnf /etc/my.cnf.d/
# fi
#fi
if [ ! -f /etc/my.cnf.d/z-php79.cnf ]; then
notice "MariaDB 기본 캐릭터셋이 utf8mb4 로 지정되었습니다.\n설정 파일 경로) /etc/my.cnf.d/z-php79.cnf"
cp -av "${STACK_ROOT}/mariadb/z-php79.cnf" /etc/my.cnf.d/
fi
if [ "$SYSTEMCTL" = "1" ]; then
systemctl enable mariadb
systemctl start mariadb
else
chkconfig mysql on
service mysql start
fi
# secure installation
notice "MariaDB 보안 강화 조치를 시작합니다. mariadb-secure-installation"
#echo -e "\nn\n\n\n\n\n" | /usr/bin/mysql_secure_installation # <= 10.3
#echo -e "\nn\nn\n\n\n\n\n" | /usr/bin/mysql_secure_installation # >= 10.4 https://github.com/php79/stack/issues/58
echo -e "\nn\nn\n\n\n\n\n" | /usr/bin/mariadb-secure-installation | grep '\[Y/n\]' # >= 10.6 https://github.com/php79/stack/issues/82#issuecomment-1189963633