우리팀 막내들을 위해서 만들었던 문서 공유 ~~
Cent7 Minimal에 설치 (7.9)
#######################
# Percona 5.6
#######################
Download : https://www.percona.com/downloads/Percona-Server-5.6/LATEST/
--> Linux Generic
--> Percona-Server-5.6.51-rel91.0-Linux.x86_64.ssl101.tar.gz
-- 패키지 설치
yum install -y zlib1g-dev gcc g++
yum install -y grub-pc-bin
yum install -y openssl
yum install -y libncurses5-dev libncursesw5-dev
yum install -y bzip2 libaio1 libaio-dev
yum install -y expect gzip vim
yum install -y perl perl-Data-Dumper -- 5.6 설치에 필수
-- 그룹 및 유저 생성
groupadd mysql
useradd -g mysql mysql
-- 설치 디렉터리 생성 및 권한 부여
mkdir -p /engine/
mkdir -p /data/5.6
mkdir -p /log/5.6
chown -R mysql:mysql /data
chown -R mysql:mysql /log
chown -R mysql:mysql /engine -- 선택
-- 설치 파일 압축 해제
tar xvf Percona-Server-5.6.51-rel91.0-Linux.x86_64.ssl101.tar.gz
mv Percona-Server-5.6.51-rel91.0-Linux.x86_64.ssl101 /engine/
cd /engine
mv Percona-Server-5.6.51-rel91.0-Linux.x86_64.ssl101 5.6
-- mysql config file 생성
vi /engine/5.6/my5.6.cnf
[mysql]
socket=/data/5.6/mysql.sock
port=3356
[mysqld]
basedir=/engine/5.6
datadir=/data/5.6
log-error=/log/5.6/error.log
pid-file=/data/5.6/mysql.pid
socket=/data/5.6/mysql.sock
slow_query_log_file=/log/5.6/MySQL-slow.log
port=3356
user=mysql
-- DB 생성
perl 및 perl-Data-Dumper가 설치 되어 있지 않으면 실행 안됨
/engine/5.6/scripts/mysql_install_db \
--defaults-file=/engine/5.6/my5.6.cnf \
--basedir=/engine/5.6 \
--datadir=/data/5.6
-- 파일 권한 다시 부여 (확인해 보고 mysql:mysql 이면 안 줘도 됨. 확인 귀찮으니 그냥 준다~~)
chown -R mysql:mysql /data
chown -R mysql:mysql /log
-- DB 기동
/engine/5.6/bin/mysqld --defaults-file=/engine/5.6/my5.6.cnf &
-- Root Password 설정
/engine/5.6/bin/mysqladmin -uroot password 'root1122' --socket=/data/5.6/mysql.sock
-- 접속 테스트
/engine/5.6/bin/mysql -uroot -p --socket=/data/5.6/mysql.sock
/engine/5.6/bin/mysql -h127.0.0.1 -P 3356 -uroot -p
-- 종료
/engine/5.6/bin/mysqladmin -uroot -p --socket=/data/5.6/mysql.sock shutdown
#######################
# Percona 5.7
#######################
Download : https://www.percona.com/downloads/Percona-Server-5.7/LATEST/
--> Linux Generic
--> Percona-Server-5.7.36-39-Linux.x86_64.glibc2.12.tar.gz
-- 패키지 설치
yum install -y zlib1g-dev gcc g++
yum install -y grub-pc-bin
yum install -y openssl
yum install -y libncurses5-dev libncursesw5-dev
yum install -y bzip2 libaio1 libaio-dev
yum install -y expect gzip vim
yum install -y perl perl-Data-Dumper -- 5.6 설치에 필수
-- 그룹 및 유저 생성
groupadd mysql
useradd -g mysql mysql
-- 설치 디렉터리 생성 및 권한 부여
mkdir -p /engine/
mkdir -p /data/5.7
mkdir -p /log/5.7
chown -R mysql:mysql /data
chown -R mysql:mysql /log
chown -R mysql:mysql /engine -- 선택
-- 설치 파일 압축 해제
tar xvf Percona-Server-5.7.36-39-Linux.x86_64.glibc2.12.tar.gz
mv Percona-Server-5.7.36-39-Linux.x86_64.glibc2.12 /engine/
cd /engine
mv Percona-Server-5.7.36-39-Linux.x86_64.glibc2.12 5.7
-- mysql config file 생성
vi /engine/5.7/my5.7.cnf
[mysql]
socket=/data/5.7/mysql.sock
port=3357
[mysqld]
basedir=/engine/5.7
datadir=/data/5.7
log-error=/log/5.7/error.log
pid-file=/data/5.7/mysql.pid
socket=/data/5.7/mysql.sock
slow_query_log_file=/log/5.7/MySQL-slow.log
port=3357
user=mysql
-- DB 생성
/engine/5.7/bin/mysqld \
--defaults-file=/engine/5.7/my5.7.cnf \
--explicit_defaults_for_timestamp \
--initialize
-- 파일 권한 다시 부여 (확인해 보고 mysql:mysql 이면 안 줘도 됨. 확인 귀찮으니 그냥 준다~~)
chown -R mysql:mysql /data
chown -R mysql:mysql /log
-- DB 기동
/engine/5.7/bin/mysqld --defaults-file=/engine/5.7/my5.7.cnf &
-- Root Password 설정
임시 패스워드 확인
grep password /log/5.7/error.log
2022-03-02T14:37:53.993193Z 1 [Note] A temporary password is generated for root@localhost: MNhJq*/>1y.K
/engine/5.7/bin/mysql_secure_installation -h127.0.0.1 -P3357
--> 임시패스워드 입력 : MNhJq*/>1y.K
-- 접속 테스트
/engine/5.7/bin/mysql -uroot -p --socket=/data/5.7/mysql.sock
/engine/5.7/bin/mysql -h127.0.0.1 -P 3357 -uroot -p
-- 종료
/engine/5.7/bin/mysqladmin -uroot -p --socket=/data/5.7/mysql.sock shutdown
#######################
# Percona 8.0
#######################
Download : https://www.percona.com/downloads/Percona-Server-8.0/LATEST/
--> Linux Generic
--> Percona-Server-8.0.26-17-Linux.x86_64.glibc2.12.tar.gz
-- 패키지 설치
yum install -y zlib1g-dev gcc g++
yum install -y grub-pc-bin
yum install -y openssl
yum install -y libncurses5-dev libncursesw5-dev
yum install -y bzip2 libaio1 libaio-dev
yum install -y expect gzip vim
yum install -y perl perl-Data-Dumper -- 5.6 설치에 필수
-- 그룹 및 유저 생성
groupadd mysql
useradd -g mysql mysql
-- 설치 디렉터리 생성 및 권한 부여
mkdir -p /engine/
mkdir -p /data/8.0
mkdir -p /log/8.0
chown -R mysql:mysql /data
chown -R mysql:mysql /log
chown -R mysql:mysql /engine -- 선택
-- 설치 파일 압축 해제
tar xvf Percona-Server-8.0.26-17-Linux.x86_64.glibc2.12.tar.gz
mv Percona-Server-8.0.26-17-Linux.x86_64.glibc2.12 /engine/
cd /engine
mv Percona-Server-8.0.26-17-Linux.x86_64.glibc2.12 8.0
-- mysql config file 생성
vi /engine/8.0/my8.0.cnf
[mysql]
socket=/data/8.0/mysql.sock
port=3380
[mysqld]
basedir=/engine/8.0
datadir=/data/8.0
log-error=/log/8.0/error.log
pid-file=/data/8.0/mysql.pid
socket=/data/8.0/mysql.sock
slow_query_log_file=/log/8.0/MySQL-slow.log
port=3380
user=mysql
-- DB 생성
/engine/8.0/bin/mysqld \
--defaults-file=/engine/8.0/my8.0.cnf \
--explicit_defaults_for_timestamp \
--initialize
-- 파일 권한 다시 부여 (확인해 보고 mysql:mysql 이면 안 줘도 됨. 확인 귀찮으니 그냥 준다~~)
chown -R mysql:mysql /data
chown -R mysql:mysql /log
-- DB 기동
/engine/8.0/bin/mysqld --defaults-file=/engine/8.0/my8.0.cnf &
-- Root Password 설정
임시 패스워드 확인
grep password /log/8.0/error.log
2022-03-02T15:17:38.702030Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: %)a4Pw876y>w
/engine/8.0/bin/mysql_secure_installation -h127.0.0.1 -P3380
--> 임시패스워드 입력 :
-- 접속 테스트
/engine/8.0/bin/mysql -uroot -p --socket=/data/8.0/mysql.sock
/engine/8.0/bin/mysql -h127.0.0.1 -P 3380 -uroot -p
-- 종료
/engine/8.0/bin/mysqladmin -uroot -p --socket=/data/8.0/mysql.sock shutdown
############################
# alias 등록
############################
vi /root/.bash_profile
alias start5.6='/engine/5.6/bin/mysqld --defaults-file=/engine/5.6/my5.6.cnf & '
alias stop5.6='/engine/5.6/bin/mysqladmin -uroot -p --socket=/data/5.6/mysql.sock shutdown'
alias mysql5.6='/engine/5.6/bin/mysql -h 127.0.0.1 -P 3356'
alias root5.6='/engine/5.6/bin/mysql -h 127.0.0.1 -P 3356 -u root -proot1122'
alias start5.7='/engine/5.7/bin/mysqld --defaults-file=/engine/5.7/my5.7.cnf & '
alias stop5.7='/engine/5.7/bin/mysqladmin -uroot -p --socket=/data/5.7/mysql.sock shutdown'
alias mysql5.7='/engine/5.7/bin/mysql -h 127.0.0.1 -P 3357'
alias root5.7='/engine/5.7/bin/mysql -h 127.0.0.1 -P 3357 -u root -proot1122'
alias start8.0='/engine/8.0/bin/mysqld --defaults-file=/engine/8.0/my8.0.cnf & '
alias stop8.0='/engine/8.0/bin/mysqladmin -uroot -p --socket=/data/8.0/mysql.sock shutdown'
alias mysql8.0='/engine/8.0/bin/mysql -h 127.0.0.1 -P 3380'
alias root8.0='/engine/8.0/bin/mysql -h 127.0.0.1 -P 3380 -u root -proot1122'
echo "
===========
Percona :
5.6 : start5.6 / stop5.6 / mysql5.6 / root5.6 / 3356
5.7 : start5.7 / stop5.7 / mysql5.7 / root5.7 / 3357
8.0 : start8.0 / stop8.0 / mysql8.0 / root8.0 / 3380
Directory :
Software : /engine
Data : /data
Logs : /log
==========
"