MYSQL 8.0.17
O/S : CentOS 7.x / 64bit
1. MYSQL 8.0.17 설치하려면 서버에서 체크해야 할 분이 몇가지 있다
아래 버전이상이여야 정상적으로 설치가 이루어진다
boost : 1..69 이상
cmake : 3.15.1 이상
gcc : 5.4 이상
2. boost 다운로드 및 압축해제
1 2 3 |
[root@localhost ~]# wget https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz [root@localhost ~]# tar xvfz boost_1_70_0.tar.gz |
3.cmake 다운로드 및 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@localhost ~]# wget https://github.com/Kitware/CMake/releases/download/v3.15.1/cmake-3.15.1.tar.gz [root@localhost ~]# tar xvfz cmake-3.15.1.tar.gz [root@localhost ~]# cd cmake-3.15.1 [root@localhost cmake-3.15.1]# ./bootstrap [root@localhost cmake-3.15.1]# make [root@localhost cmake-3.15.1]# make install [root@localhost cmake-3.15.1]# cp -f ./bin/cmake ./bin/cpack ./bin/ctest /bin/ cp: overwrite `/bin/cmake'? y cp: overwrite `/bin/cpack'? y cp: overwrite `/bin/ctest'? y [root@localhost cmake-3.15.1]# cmake --version cmake version 3.15.1 |
4. gcc 6.3 설치
1 2 3 4 5 6 7 8 9 |
[root@localhost ~]# yum -y install centos-release-scl [root@localhost ~]# yum -y install devtoolset-6-gcc* [root@localhost ~]# scl enable devtoolset-6 bash [root@localhost ~]# gcc --version gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3) Copyright (C) 2016 Free Software Foundation, Inc. |
5. MYSQL 8.0.17 다운로드 및 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[root@localhost ~]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17.tar.gz [root@localhost ~]# tar xvfz mysql-8.0.17.tar.gz [root@localhost ~]# cd mysql-8.0.17 cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/home/mysql_data \ -DSYSCONFDIR=/etc \ -DMYSQL_USER=mysql \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSOL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DENABLE_DOWNLOADS=1 \ -DWITH_EXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_DEBUG=0 \ -DMYSQL_MAINTAINER_MODE=0 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/usr/include [root@localhost mysql-8.0.17]# make install |
6.MYSQL 사용자 추가 및 시작 스크립트 구성
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[root@localhost mysql-8.0.17]# useradd -M mysql -u 27 >& /dev/null [root@localhost mysql-8.0.17]# chown -R root:mysql /usr/local/mysql [root@localhost mysql-8.0.17]# 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]# vi /usr/lib/systemd/system/mysql.service [Unit] Description=MySQL Server After=network.target [Service] Type= forking ExecStart = /etc/rc.d/init.d/mysql start ExecStop = /etc/rc.d/init.d/mysql stop [Install] WantedBy=multi-user.target |
7. systemctl 등록
1 2 3 |
[root@localhost ~]# systemctl daemon-reload [root@localhost ~]# systemctl enable mysql.service |
8. my.cnf 파일 작성 ( 기존 엔진 MyISAM ) / Innodb 를 사용하는경우 9번 my.cnf 항목 사용
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
[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 = 16M table_open_cache = 2048 sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 #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 = /home/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 = 512M [mysql] #no-auto-rehash default-character-set = utf8 [myisamchk] key_buffer_size = 512M sort_buffer_size = 512M read_buffer = 8M write_buffer = 8M |
9. my.cnf 파일 작성 ( 기존 엔진 Innodb )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
[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 = 16M table_open_cache = 2048 sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 #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 = /home/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 = 512M [mysql] #no-auto-rehash default-character-set = utf8 [myisamchk] key_buffer_size = 512M sort_buffer_size = 512M read_buffer = 8M write_buffer = 8M |
10. mysql db install
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@localhost mysql]# /usr/local/mysql/bin/mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/home/mysql_data --user=mysql [root@localhost mysql]# ll /home/mysql_data/ 합계 154684 drwxr-x---. 2 mysql mysql 6 8월 5 10:46 #innodb_temp -rw-r-----. 1 mysql mysql 56 8월 5 10:46 auto.cnf -rw-------. 1 mysql mysql 1676 8월 5 10:46 ca-key.pem -rw-r--r--. 1 mysql mysql 1112 8월 5 10:46 ca.pem -rw-r--r--. 1 mysql mysql 1112 8월 5 10:46 client-cert.pem -rw-------. 1 mysql mysql 1680 8월 5 10:46 client-key.pem -rw-r-----. 1 mysql mysql 5317 8월 5 10:46 ib_buffer_pool -rw-r-----. 1 mysql mysql 50331648 8월 5 10:46 ib_logfile0 -rw-r-----. 1 mysql mysql 50331648 8월 5 10:46 ib_logfile1 -rw-r-----. 1 mysql mysql 12582912 8월 5 10:46 ibdata1 drwxr-x---. 2 mysql mysql 143 8월 5 10:46 mysql -rw-r-----. 1 mysql mysql 24117248 8월 5 10:46 mysql.ibd drwxr-x---. 2 mysql mysql 8192 8월 5 10:46 performance_schema -rw-------. 1 mysql mysql 1676 8월 5 10:46 private_key.pem -rw-r--r--. 1 mysql mysql 452 8월 5 10:46 public_key.pem -rw-r--r--. 1 mysql mysql 1112 8월 5 10:46 server-cert.pem -rw-------. 1 mysql mysql 1680 8월 5 10:46 server-key.pem drwxr-x---. 2 mysql mysql 28 8월 5 10:46 sys -rw-r-----. 1 mysql mysql 10485760 8월 5 10:46 undo_001 -rw-r-----. 1 mysql mysql 10485760 8월 5 10:46 undo_002 |
11. mysql 서비스 시작 및 중지
1 2 3 |
[root@localhost ~]# systemctl stop mysql [root@localhost ~]# systemctl start mysql |
12. 서비스 시작 후 내용 환경 확인
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
[root@localhost ~]# /usr/local/mysql/bin/mysql -u root -p mysql Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.17 Source distribution Copyright (c) 2000, 2019, 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 8.0.17 for Linux on x86_64 (Source distribution) Connection id: 8 Current database: mysql Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.17 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 45 sec Threads: 2 Questions: 41 Slow queries: 0 Opens: 170 Flush tables: 3 Open tables: 90 Queries per second avg: 0.248 -------------- mysql> |