1. 소스파일 다운로드
http://dev.mysql.com/downloads/
MySQL Community Server(GPL) Download (5.7.13)
Source Code 선택: mysql-version.tar.gz 과 mysql-boost-version.tar.gz 다운로드 후 압축해제
2. 필수 프로그램, 라이브러리 설치
[root@localhost mysql-5.7.13]# yum -y install gcc*
[root@localhost mysql-5.7.13]# yum -y install ncurses ncurses-devel cmake
3. MySQL 컴파일, 설치
[root@localhost mysql-5.7.13]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DWITH_EXTRA_CHARSETS=all \
-DMYSQL_DATADIR=/home/mysql_data \
-DENABLED_LOCAL_INFILE=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=../boost_1_59_0 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFDIR=/etc \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all
[root@localhost mysql-5.7.13]# make && make install
4. MySQL 기타 환경설정
[root@localhost mysql-5.7.9]# useradd -M mysql -u 27 >& /dev/null
[root@localhost mysql-5.7.9]# chown -R root:mysql /usr/local/mysql
[root@localhost mysql-5.7.9]# cd /usr/local/mysql
[root@localhost mysql]# chmod 700 support-files/mysql.server
[root@localhost mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysql
[root@localhost mysql]# ln -s /etc/rc.d/init.d/mysql /etc/rc.d/rc3.d/S97mysql
[root@localhost mysql]# cp support-files/mysql.server /usr/bin/
[root@localhost mysql]# vi /etc/my.cnf
[client]
default-character-set = utf8
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
socket=/tmp/mysql.sock
datadir=/home/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 = /home/mysql_data/slow-queries.log
#long_query_time = 3
#log-slow-queries = /free/mysql_data/mysql-slow-queries.log
##timestamp
explicit_defaults_for_timestamp
symbolic-links=0
### log
log-error=/home/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
[root@localhost mysql]# cd /home
[root@localhost home]# mkdir mysql_data
[root@localhost mysql_data]# /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/home/mysql_data
2016-07-23 23:34:42 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
실제 해당 디렉토리에 mysql install 되었는지 확인
[root@localhost ~]# ls -l /home/mysql_data
합계 469064
-rw-r----- 1 mysql mysql 56 2015-11-27 10:02 auto.cnf
-rw------- 1 root root 1675 2015-11-27 10:02 ca-key.pem
-rw------- 1 root root 944 2015-11-27 10:02 ca-req.pem
-rw------- 1 root root 1070 2015-11-27 10:02 ca.pem
-rw------- 1 root root 1078 2015-11-27 10:02 client-cert.pem
-rw------- 1 root root 1679 2015-11-27 10:02 client-key.pem
-rw------- 1 root root 948 2015-11-27 10:02 client-req.pem
-rw-r----- 1 mysql mysql 407 2015-11-27 10:02 ib_buffer_pool
-rw-r----- 1 mysql mysql 134217728 2015-11-27 10:02 ib_logfile0
-rw-r----- 1 mysql mysql 134217728 2015-11-27 10:02 ib_logfile1
-rw-r----- 1 mysql mysql 134217728 2015-11-27 10:02 ib_logfile2
-rw-r----- 1 mysql mysql 77594624 2015-11-27 10:02 ibdata1
drwxr-x--- 2 mysql mysql 4096 2015-11-27 10:02 mysql
-rw-r----- 1 mysql mysql 407 2015-11-27 10:02 mysqld.log
drwxr-x--- 2 mysql mysql 4096 2015-11-27 10:02 performance_schema
-rw------- 1 root root 1078 2015-11-27 10:02 server-cert.pem
-rw------- 1 root root 1675 2015-11-27 10:02 server-key.pem
-rw------- 1 root root 948 2015-11-27 10:02 server-req.pem
drwxr-x--- 2 mysql mysql 12288 2015-11-27 10:02 sys
5. 설치완료. mysql 시작
[root@localhost ~]# mysql.server start
Starting MySQL. SUCCESS!
6. mysql root user 패스워드 설정
mysql root 접속을 위해서 패스워드가 필요 ( 데이터베이스 생성시 자동으로 암호가 지정된다 )
[root@localhost ~]# cat /root/.mysql_secret
# Password set for user 'root@localhost' at 2015-11-27 09:51:39
GGWBtXdowyXN
기록된 패스워드를 가지고 mysql 접속을 진행. 접속 후 환경설정을 확인하려면 에레메시지가 발생
You must reset your password using ALTER USER statement before executing this statement.S
root 패스워드를 변경
[root@localhost mysql_data]# /usr/local/mysql/bin/mysql -u root -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> \s
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '변경할패스워드';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost mysql_data]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.13 Source distribution
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> \s
--------------
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.7.13, for Linux (x86_64) using EditLine wrapper
Connection id: 5
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.13 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 2 min 1 sec
Threads: 1 Questions: 10 Slow queries: 0 Opens: 114 Flush tables: 1 Open tables: 39 Queries per second avg: 0.082
--------------
mysql> quit
Bye
이제 환경에 맞게 my.cnf 를 변경하면서 운용
참고자료: http://xinet.kr/?p=991
참고자료: http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
'리눅스 문서' 카테고리의 다른 글
mongoDB 인증설정하기 (4) | 2018.01.30 |
---|---|
centos5.x 에 Virtualbox 설치하기 (4) | 2017.12.19 |
MySQL 5.7.x Configure시 CMake Boost 오류 처리 방법 (4) | 2017.11.23 |
CentOS 5.x Error: Cannot find a valid baseurl for repo: extras (4) | 2017.10.26 |
redis 데이터 새서버로 이전하기 (4) | 2016.12.01 |