728x90
반응형
SMALL
설치 환경
OS : CentOS7
Version : 5.6.15
※ 순서대로 설치를 안하시면 오작동 확률이 높습니다.
1. mysql 설치하기 위해 필요한 패키지 설치
[root@localhost home]# yum -y install gcc gcc-c++ ncurses ncurses-devel cmakeyum perl perl-Data-Dumper
2. mysql 설치
[root@localhost home]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz [root@localhost home]# tar xvfz mysql-5.6.15.tar.gz [root@localhost home]# cd mysql-5.6.15
3. Configure
[root@localhost mysql-5.6.15]# mkdir -p /usr/local/mysql [root@localhost mysql-5.6.15]# cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 \ -DENABLE_DOWNLOADS=1 [root@localhost mysql-5.6.15]# make && make install
4. 유저 생성
[root@localhost mysql-5.6.15]# groupadd mysql [root@localhost mysql-5.6.15]# useradd -M -g mysql mysql
5. 디렉토리 소유자 변경
[root@localhost mysql-5.6.15]# mkdir /usr/local/mysql/tmp [root@localhost mysql-5.6.15]# chown -R mysql:mysql /usr/local/mysql [root@localhost mysql-5.6.15]# chown mysql:root /usr/local/mysql/tmp
6. 기본 데이터베이스 생성
[root@localhost mysql-5.6.15]# /usr/local/mysql/scripts/mysql_install_db \ --defaults-file=/usr/local/mysql/my.cnf \ --user=mysql \ --basedir=/usr/local/mysql/ \ --datadir=/usr/local/mysql/data \ --explicit_defaults_for_timestamp=on
7. MySQL 환경설정
[root@localhost mysql-5.6.15]# vi /etc/my.cnf [client] port = 3306 socket = /usr/local/mysql/tmp/mysql.sock character-set = utf8 [mysqld] port = 3306 socket = /usr/local/mysql/tmp/mysql.sock key_buffer_size = 256M max_allowed_packet = 1M table_open_cache = 256 sort_buffer_size = 1M read_buffer_size = 1M read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size= 16M thread_concurrency = 8 character-set-server=utf8 collation-server=utf8_general_ci init_connect=SET collation_connection=utf8_general_ci init_connect=SET NAMES utf8 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash default-character-set = utf8 [myisamchk] key_buffer_size = 128M sort_buffer_size = 128M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout
8. Mysql 실행
[root@localhost mysql-5.6.15]# /usr/local/mysql/bin/mysqld_safe & [root@localhost mysql-5.6.15]# ps -ef | grep mysql
9. mysql 환경 변수 설정 및 등록(자동실행)
[root@localhost mysql-5.6.15]# vi /etc/profile (파일 맨 끝에 export 추가) export PATH=$PATH:/usr/local/mysql/bin (저장하고 종료)
[root@localhost mysql-5.6.15]# vi /usr/lib/systemd/system/mysql.service [Unit] Description=MySQL Community Server After=network.target After=syslog.target [Install] WantedBy=multi-user.target Alias=mysql.service [Service] User=mysql Group=mysql PermissionsStartOnly=true ExecStart=/usr/local/mysql/bin/mysqld_safe TimeoutSec=300 Restart=always PrivateTmp=false (저장하고 종료)
[root@localhost mysql-5.6.15]# systemctl enable mysql.service [root@localhost mysql-5.6.15]# reboot
728x90
반응형
LIST
'Database' 카테고리의 다른 글
데이터베이스 인덱싱의 이해: 인덱스의 장단점 깊게 알아보기 (0) | 2023.07.10 |
---|---|
mysql에서 백업 후 다른 곳으로 옮기기(mysqldump) (0) | 2018.10.05 |
커넥션 풀(Connection pool) (0) | 2018.03.14 |
정규화(normalization) (0) | 2018.03.10 |