반응형
1. mysql 유저생성
groupadd mysql useradd -M -g mysql mysql cat /etc/passwd |
2. 의존성 설치
- MySQL을 컴파일 하기 위한 라이프러리 설치
yum -y install ncurses-devel yum -y install perl yum -y install perl-Data-Dumper yum -y install cmake yum -y install wget yum -y install gcc-c++ yum install -y cmake bison gcc gcc-c++ ncurses-devel yum install devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-binutils |
3. MySQL 바이너리 준비
사이트 에서 직접 다운로드 받아서 upload로 진행
https://downloads.mysql.com/archives/community/
MySQL :: Download MySQL Community Server (Archived Versions)
Please note that these are old versions. New releases will have recent bug fixes and features! To download the latest release of MySQL Community Server, please visit MySQL Downloads. MySQL open source software is provided under the GPL License.
downloads.mysql.com
4. 압축 해제 후 cmake명령어를 통해 설치치 옵션을 부여하고
tar -zxvf mysql-boost-8.0.27.tar.gz cd mysql-8.0.27 # mkdir /usr/local/mysql cmake3 \ -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=5500 \ -DENABLE_DOWNLOADS=1 \ -DFORCE_INSOURCE_BUILD=1 \ -DWITH_BOOST=/usr/local/mysql-8.0.27/boost |
5. make로 빌드, make install 설치
# make # make install |
6. 환경 변수 파일 확인
스마트 물류랑 비교해서 필요할거 같은 parameter들 넣어주기 [client] port = 5550 socket = /tmp/dkgcsprd/mysql.sock [mysqld] user = mysql port = 5550 tmpdir = /tmp/dkgcsprd/ socket = /tmp/dkgcsprd/mysql.sock basedir = /usr/local/mysql/ datadir = /data1/dkgcsprd_database #enable for use function in procedure log_bin_trust_function_creators = TRUE skip-host-cache skip-name-resolve query_cache_type = 0 query_cache_size = 16M query_cache_limit = 2M local-infile =0 lower_case_table_names = 1 explicit_defaults_for_timestamp = on # Log file setting slow_query_log = 1 slow_query_log_file = /usr/local/mysql/logs/mysql-slow-query.log log-error = /usr/local/mysql/logs/mysql.err long_query_time = 1 expire_logs_days = 7 log_timestamps = SYSTEM # Time out setting wait_timeout = 3600 interactive_timeout = 600 # Transaction setting transaction_isolation = READ-COMMITTED # Session Memory back_log = 1024 max_connections = 4096 max_connect_errors = 100 table_open_cache = 2000 max_allowed_packet = 16M max_heap_table_size = 1024M sort_buffer_size = 2M join_buffer_size = 2M thread_cache_size = -1 tmp_table_size = 1024M # Character set setting (default utf8) init_connect = "SET collation_connection = euckr_korean_ci" init_connect = "SET NAMES euckr" collation-server = euckr_korean_ci character-set-server = euckr # Innodb Engine # buffer pool size = physical memory * 0.7 # buffer pool instances = buffer pool size / 2 # innodb_thread_concurrency = 2*(core+disk) ## default Engine default-storage-engine=InnoDB innodb_file_per_table innodb_lock_wait_timeout = 50 innodb_thread_sleep_delay = 0 innodb_commit_concurrency = 20 innodb_doublewrite = 0 innodb_flush_log_at_trx_commit = 2 innodb_thread_concurrency = 36 innodb_log_buffer_size = 128M innodb_log_file_size = 256M innodb_log_files_in_group = 5 innodb_data_file_path = ibdata1:10M:autoextend innodb_flush_method = O_DIRECT innodb_buffer_pool_size = 20G innodb_buffer_pool_instances = 10 innodb_max_dirty_pages_pct = 90 innodb_stats_on_metadata = 0 innodb_print_all_deadlocks = 1 innodb_doublewrite = 1 innodb_read_io_threads=64 innodb_write_io_threads=64 innodb_buffer_pool_dump_at_shutdown = 0 innodb_buffer_pool_load_at_startup = 0 innodb_buffer_pool_dump_pct = 100 # MyISAM Engine key_buffer_size = 32M read_buffer_size = 2M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 2G myisam_repair_threads = 1 # Mysql ThreadPool #thread_pool_size = 16 #thread_handling = pool-of-threads #thread_pool_max_threads = 1000 # Replication server_id = 2 binlog_cache_size = 4M max_binlog_size = 2000M relay-log-purge = 1 binlog_format = MIXED log-bin = /usr/local/mysql/logs/mysql-bin.log relay_log = /usr/local/mysql/logs/mysql-relay.log auto_increment_increment = 2 auto_increment_offset = 1 # Set Unique Value to Both Server # validate_password plugin-load = validate_password.so validate-password = ON validate_password_length = 8 validate_password_policy = 1 validate_password_mixed_case_count = 1 validate_password_number_count = 1 validate_password_special_char_count = 1 validate_password_policy = 'LOW' # validate_password_policy = LOW default_password_lifetime=0 [mysqldump] quick [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192 |
7. 기본DB 초기화
vi install.sh bin/mysqld --defaults-file=./my.cnf --initialize --user=mysql --datadir=/data1/dkgcsprd_database sh install.sh -- 로그에서 임시비밀번호가 나오는데 기록해두기 |
8. 서버시작
bin/mysqld_safe --user=mysql & ps -ef | grep mysqld --mysql로 전환 bin/mysql -u root -p -비밀번호 설정 alter user 'root'@'localhost' identified by 'mysql'; exit |
9. MySQL 서비스 등록 하기
반응형
'Database > MYSQL' 카테고리의 다른 글
[MYSQL] Dump기능을 사용하여 백업, 복구 (0) | 2022.10.12 |
---|---|
[MYSQL] 스키마구조 (0) | 2022.10.07 |
[MYSQL] 계정 및 권한 관리 (0) | 2022.10.02 |
[MYSQL] 정적, 동적 Parameter 적용 (0) | 2022.09.29 |
[MYSQL] Linux에서 바이너리 설치 (0) | 2022.09.22 |