본문 바로가기

전체 글

Mysql utf8 collation 문제 서버환경: CentOS7, mysql 5.7 mysql의경우 같은 utf8이라도 Collation에 있어서, utf8_unicode_ci와 utf8_general_ci의 중돌 문제가 있음. utf8_unicode_ci는 정확성이 좋으나 성능이 떨어지고, utf8_general_ci은 반대로 성능이 우수하다. default는 utf8_general_ci로 변경했으나 만약 문제가 있으면... > Alter Database DB명 Collate utf8_general_ci로 DB 초기 값을 설정을 변경한다. mysql의 설정 값을 보려면, > show variables like 'c%'; 더보기
Mysql 데이터 원격 복제(replication) master 서버의 mysql 데이터를 slave 서버로 원격 복제하고 싶은 경우가 있는데, 이때 활용할 수 있음. 다만, 오랜기간 실험한 것이 아니라 다소 불안정할 수 있는 점 양해 바랍니다^^ 서버환경: CentOS7, mysql 5.7 [Master 서버 설정] 1. 설정 # vi /etc/my.cnf 에 아래 내용 추가 log-bin=mysql-bin server-id=1 FLUSH TABLES WITH READ LOCK; change master to master_host ='123.123.123.123', master_port =3306, master_user ='유저아이디', master_password ='패스워드', master_log_file ='mysql-bin.000002', mas.. 더보기
MySql 2개 테이블 JOIN 업데이트 / 삭제 mysql 2개의 테이블을 특정 칼럼을 기준으로 연동하여 업데이트 또는 삭제하기 위한 쿼리 1. 테이블 업데이트 update TBL1 a inner join TBL2 b on a.col1 = b.col1 set a.col2 > 1 2. 테이블 삭제 [방법1] delete a from TBL1 a inner join TBL2 b on a.col1 = b.col1 where b.col2 = 'AAA' [방법2] delete from a using TBL1 a inner join TBL2 b on a.col1 = b.col1 where b.col2 = 'AAA' 더보기
MySql Fulltext 검색 MySql 5.7 이상은 InnoDB Fulltext Search에 대한 파서를 지원함. 1. mysql 시스템 변수 설정 검색시 문장 또는 단어를 잘라서 분석하기 위한 음절의 단위를 설정하기 위해 # vi /etc/my.cnf 아래 한 줄을 추가함. ngram_token_size=2 (토큰 값은 1~10, 기본 설정은 2) 2. Fulltaxt 인덱스 생성 - table 생성시 mysql> create table 테이블명 (id int auto-increment not null primary key, 칼럼1 varchar(50), 칼럼2 varchar(255), fulltext index ngram_idx(칼럼1) with parser ngram) engine=innodb character set ut.. 더보기
iptable 설정 리눅스 서버가 웹서버, DB서버 등을 원격으로 서비스 하되, 서비스 별로 원격 접속 허용을 제한하기 위한 iptable 설정방법 CentOS 7에서 테스트 1. firewall 중지 #systemctl stop firewalld #systemctl mask firewalld 2. iptable 설치 및 구동 #yum install iptables-servieces -y #systemctl enable iptables #systemctl start iptables 3. iptable 설정 # vi /etc/sysconfig/iptables # sample configuration for iptables service # you can edit this manually or use system-config-.. 더보기
httpd 2.2 에 php7 설치 httpd 2.2 ( 더보기
아파치 웹서버 가상호스트 설정 아파치 웹서버 (http) 멀티 도메인을 사용할 수 있는 가상호스트를 설정하는 방법 1. http 설정변경 #vi /etc/httpd/conf/httpd.conf/httpd 맨 아래부분에 추가 Include conf/extra/httpd-vhosts.conf 2. /etc/httpd/conf/아래 extra폴더를 만들고 httpd-vhosts.conf 파일을 만들어 다음 내용을 넣음. NameVirtualHost *:80 DocumentRoot "/var/www/html" DocumentRoot "/var/www/html/가상호스트폴더" ServerName 가상호스트도메인주소 더보기
mariadb 설치 마리아DB(mariadb) 설치 centos7 기준으로 설명함.(단, centos배포판에는 기본적으로 설치되어 있음) 1. 설치 # yum install -y mariadb-server # systemctl enable mariadb # systemctl start mariadb 2. root 패스워드 # mysqladmin -u root password **** 3. 사용자 mysql root 접속 > create user '사용자ID'@'%' identified by '비번'; GRANT ALL PRIVILEGES ON 데이터베이스.* TO '사용자ID'@'%'; > flush privileges; 4 비번변경 > set password for 사용자ID=password('비번'); 5. 문자셋 변경.. 더보기