CentOS 7.6.1810 OS에
Mysql 5.7.25 비교적 신버전 소스 설치 진행.
기본조건 : OS Package Minimal + Development Tools + Wget 설치.
컨피그 옵션에 Apache 관련이 들어갈 경우, Apache가 먼저 설치되어야 함.
( 보통 소스는 A M P 순서대로 설치 하더랍니다.... )
cd /usr/local/src/
yum -y install cmake ncurses-devel
groupadd -g 400 mysql
useradd -u 400 -g 400 -d /usr/local/mysql -s /bin/false mysql
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.25.tar.gz
tar zxvf mysql-5.7.25.tar.gz
cd mysql-5.7.25
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFDIR=/etc \
-DDEFAULT_CHARSET=utf8 \
-DMYSQL_TCP_PORT=3306 \
-DWITH_EXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/include/boost
make -j 3
// CPU 코어가 많은경우 수량 적절히 조절해주면 약간의 속도 효과를 볼 수있음
make install
cd /usr/include/boost/boost_1_59_0
./bootstrap.sh
./b2 install
cd /usr/local/src/
echo "[client]
default-character-set = utf8
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
socket=/tmp/mysql.sock
datadir=/usr/local/mysql/data
basedir = /usr/local/mysql
#user = mysql
#bind-address = 0.0.0.0
#
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
#dns query
skip-name-resolve
#connection
max_connections = 1000
max_connect_errors = 1000
wait_timeout= 60
#slow-queries
#slow_query_log = /usr/local/mysql/data/slow-queries.log
#long_query_time = 3
#log-slow-queries = /usr/local/mysql/data/mysql-slow-queries.log
##timestamp
explicit_defaults_for_timestamp
symbolic-links=0
### log
log-error=/usr/local/mysql/data/mysqld.log
pid-file=/tmp/mysqld.pid
###chracter
character-set-client-handshake=FALSE
init_connect = SET collation_connection = utf8_general_ci
init_connect = SET NAMES utf8
character-set-server = utf8
collation-server = utf8_general_ci
symbolic-links=0
##Password Policy
#validate_password_policy=LOW
#validate_password_policy=MEDIUM
### MyISAM Spectific options
default-storage-engine = myisam
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
### INNODB Spectific options
#default-storage-engine = InnoDB
#skip-innodb
#innodb_additional_mem_pool_size = 16M
#innodb_buffer_pool_size = 1024MB
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_write_io_threads = 8
#innodb_read_io_threads = 8
#innodb_thread_concurrency = 16
#innodb_flush_log_at_trx_commit = 1
#innodb_log_buffer_size = 8M
#innodb_log_file_size = 128M
#innodb_log_files_in_group = 3
#innodb_max_dirty_pages_pct = 90
#innodb_lock_wait_timeout = 120
[mysqldump]
default-character-set = utf8
max_allowed_packet = 16M
[mysql]
no-auto-rehash
default-character-set = utf8
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M" > /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
chown -R mysql.mysql /usr/local/mysql
chmod 711 /usr/local/mysql
chmod 707 /usr/local/mysql/data
chmod 751 /usr/local/mysql/bin
chmod 750 /usr/local/mysql/bin/*
chmod 755 /usr/local/mysql/bin/mysql
chmod 755 /usr/local/mysql/bin/mysqldump
echo "export PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/php/bin:" >> /etc/profile
source /etc/profile
/etc/init.d/mysqld [ start | stop | restart ]
초기패스워드 : 숨겨진 .mysql_secret 파일에 적혀있음.
mysql_secure_install 또는 DB 접속 후 패스워드 갱신해 주어야 합니다.
'Linux ( Cent OS ) > Apache' 카테고리의 다른 글
[설치] 1. Apache 2.4.39 Source Install (0) | 2019.04.18 |
---|---|
[설치] 3. PHP 7.3.4 Source Install (0) | 2019.04.18 |