reference
https://salix97.tistory.com/141
https://jirak.net/wp/cmake-error-for-mysql-8-0-15-please-do-not-build-in-source/
https://stackoverflow.com/questions/46259776/collect2-fatal-error-ld-terminated-with-signal-9-killed
https://www.oofbird.me/60
Ubuntu 20.04 + Apache 2.4.46 소스 설치(컴파일 설치, 수동 설치)에서 이어집니다.
Virtual Box, Ubuntu 20.04
$ sudo su
/usr/local# apt-get update
/usr/local# apt-get install cmake
/usr/local# apt-get install libssl-dev
/usr/local# apt-get install libboost-all-dev
/usr/local# apt-get install libncurses5-dev libncursesw5-dev
/usr/local# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.19.tar.gz
/usr/local# tar xvfz mysql-8.0.19.tar.gz
reference
https://dev.mysql.com/doc/refman/8.0/en/source-configuration-options.html
/usr/local/mysql-8.0.19# cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_DATADIR=/usr/local/mysql/data \
> -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
> -DMYSQL_TCP_PORT=3306 \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DSYSCONFDIR=/etc \
> -DWITH_EXTRA_CHARSETS=all \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
> -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
> -DDOWNLOAD_BOOST=1 \
> -DWITH_BOOST=/usr/local/mysql/boost
/usr/local/mysql-8.0.19/springmysql# cmake \
> .. \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_DATADIR=/usr/local/mysql/data \
> -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
> -DMYSQL_TCP_PORT=3306 \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DSYSCONFDIR=/etc \
> -DWITH_EXTRA_CHARSETS=all \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
> -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
> -DDOWNLOAD_BOOST=1 \
> -DWITH_BOOST=/usr/local/mysql/boost
/usr/local/mysql-8.0.19/springmysql# make
/usr/local/mysql-8.0.19/springmysql# make install
It is memory exhaustion. The sampling interval for the memory measurement is just not small enough that it covers the exact point where the OOM killer kicks in.
메모리가 부족해서 생긴것으로 보임. 확인해보자
현재 39G 중에서 19G를 사용중이고, 19G를 더 쓸 수 있다고 나옴(Use 50%). 여유가 있는 것 같아서 뭔가 이상하긴 하지만.. 혹시 모르니 Disk 크기를 키워보자
reference
https://ndb796.tistory.com/418
80G로 Disk 크기를 키웠지만 여전히 설치안 됨. 알고보니 메모리가 부족하다는 건 Swap 크기가 부족하다는 것이였음.
Swap크기를 8G로 키운 뒤, 설치가 정상적으로 되었다.
/usr/local/# cd mysql
/usr/local/mysql# mkdir mysql-files
/usr/local/mysql# chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql# chown mysql:mysql mysql-files
/usr/local/mysql# chmod 750 mysql-files
/usr/local/mysql/bin# ./mysqld --initialize --user=mysql \
> --basedir=/usr/local/mysql \
> --datadir=/usr/local/mysql/data
/usr/local/mysql/bin# ./mysqld_safe --user=mysql &
$ ps -ef | grep mysqld
/usr/local/mysql/bin# ./mysql -u root -p
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '바꿀 패스워드';
/usr/local/mysql/bin# ./mysqladmin -u root -p shutdown
ps -ef | grep mysqld 명령어로 서버가 종료된 것을 확인할 수 있다.
MySQL 서비스를 등록해놓으면 서버가 실행되었을 때, mysql이 자동으로 실행된다.
/usr/local/# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
/usr/local/# vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
basedir, datadir 뒤에 경로 추가
/usr/local# update-rc.d mysqld defaults
/usr/local# service mysql start
/usr/local# service mysql stop
/usr/local# service mysql restart
/usr/local# service mysql status //서버 상태 확인. 나갈 땐 q
/usr/local/# vi /etc/my.cnf
[mysqld]
bind-address=0.0.0.0
port=3306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
위의 내용을 my.cnf 파일에 작성
옵션에 port가 추가된 것 확인할 수 있음