MySQL 5.5 설치(CentOS)
## 소스코드 다운로드
$ wget https://dev.mysql.com/get/Downloads/MySQL-{메이저버전}/mysql-{버전}.tar.gz
## 5.5.56 예시)
wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56.tar.gz
## mysql 유저 확인
$ cat /etc/passwd | grep mysql
## mysql 그룹 확인
$ cat /etc/group | grep mysql
## 없다면 그룹과 계정 생성
groupadd mysql
useradd -g mysql mysql
## 설치가 되어있지 않다면 다음의 명령으로 설치 진행
## mysql 데이터 및 설정 필요한 디렉토리 생성
$ mkdir /데이터경로/
## 파일 디렉토리 권한 mysql로 변경
$ chown -R mysql.mysql 권한설정필요디렉토리
## 실행파일 /mysql 폴더로 이동
$ mv mysql-5.5.56.tar.gz /mysql/
## 압축 풀기.
$ tar -zxvf mysql-5.5.56.tar.gz
$ cd mysql-5.5.56
## Tip: 컴파일 전 아래의 패키지 설치 확인
$ yum -y install zlib curl
$ yum -y install gcc g++ cpp gcc-c++
$ yum -y install openssl openssl-devel
$ yum -y install libtermcap-devel ncurses-devel libc-client-devel bzip2-devel
$ yum -y install bison
$ yum -y install cmake
## 컴파일
$ cmake -DCMAKE_INSTALL_PREFIX=/mysql \ -- 인스톨 경로
-DMYSQL_DATADIR=/데이터디렉토리 \ -- 데이터디렉토리 경로
-DDEFAULT_CHARSET=utf8 \ -- 캐릭터셋
-DDEFAULT_COLLATION=utf8_general_ci \ -- 콜레이션
-DWITH_EXTRA_CHARSETS=all \ -- 기타 캐릭터셋
-DENABLED_LOCAL_INFILE=1 \ -- local infile(파일 벌크 업로드) 설정여부
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ -- innobase 스토리지 엔진 추가 여부
-DWITH_SSL=bundled \ -- ssl 통신 추가 여부
## 설치
$ make
$ make install
## 컴파일 실패시 재수행 방법
$ make clean
$ rm CMakeCache.txt
## 퍼미션 변경
chmod 750 /mysql/support-files/mysql.server
chmod 750 /mysql/bin/mysqld_safe
## my.cnf 심볼릭 링크로 설정
$ rm -f /etc/my.cnf
$ ln -s /원하는위치/my.cnf /etc/my.cnf
## mysql DB 생성
$ /mysql/scripts/mysql_install_db --user=mysql --basedir=/mysql --datadir=/data/ismdata/ --defaults-file=/etc/my.cnf
Installing MySQL system tables...
OK
Filling help tables...
OK
## 구동 및 종료 명령
## 구동
/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
## 종료
/mysql/bin/mysqladmin shutdown -u{dba계정} -p
MySQL 5.7 설치(CentOS)
## 소스파일 다운로드
wget https://dev.mysql.com/get/Downloads/MySQL-{메이저버전}/mysql-boost-{버전}.tar.gz
## mysql 유저 확인
$ cat /etc/passwd | grep mysql
## mysql 그룹 확인
$ cat /etc/group | grep mysql
## 없다면 그룹과 계정 생성
groupadd mysql
useradd -g mysql mysql
## cmake 확인 및 설치.
$ which cmake
/usr/bin/cmake
## 설치가 되어있지 않다면 다음의 명령으로 설치 진행
$ yum install cmake
$ tar xvfz mysql-boost-5.7.13.tar.gz
## gcc 4.4.7 에서는 오류 발생!!
## mysql cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedefs"
## gcc 4.7.2 로 업그레이드 후 진행
## 업그레이드 방법
$ wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d
$ yum install devtoolset-1.1
$ scl enable devtoolset-1.1 bash
$ cmake .. -DCMAKE_INSTALL_PREFIX=/mysql \
-DMYSQL_DATADIR=/데이터디렉토리경로 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_BOOST=../boost/boost_1_59_0 \ -- 부스트 디렉토리 경로
-DENABLE_DOWNLOADS=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1
(빌드 옵션: http://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html)
$ make -j `grep processor /proc/cpuinfo | wc -l`
$ make install
## 컴파일 실패시 재수행 방법
$ make clean
$ rm CMakeCache.txt
## 퍼미션 변경
chmod 750 /mysql/support-files/mysql.server
chmod 750 /mysql/bin/mysqld_safe
## my.cnf 심볼릭 링크로 설정
$ rm -f /etc/my.cnf
$ ln -s /원하는위치/my.cnf /etc/my.cnf
$ /mysql/bin/mysqld --initialize
...
0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
1 [Note] A temporary password is generated for root@localhost: 임시비밀번호
/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
$ /mysql/bin/mysql -uroot --socket=/dblab/var/mysql.sock -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.13
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by '비밀번호';
Query OK, 0 rows affected (0.00 sec)
'MySQL & Aurora' 카테고리의 다른 글
| MySQL Internal 살펴보기 - SELECT 수행과정 (0) | 2021.10.14 |
|---|---|
| MySQL 원하는 버전으로 패키지 설치(With Amazon Linux) (0) | 2021.10.08 |
| What Is New In MySQL 5.7 (0) | 2018.04.05 |
| 2018-01-11 Percona Webinar 요약 (0) | 2018.01.11 |
| MySQL Position 설정(SBR의 경우 무엇으로 맞출까?) (0) | 2018.01.05 |