본문 바로가기
반응형

Database/MYSQL227

서브 쿼리 이용(자신의 그룹에 맞는값 가져오기) 자신의 그룹에 맞는값 가져오기 (no_1,no_2,no_3,no_4) DROP TABLE IF EXISTS `TB_A`; CREATE TABLE `TB_A` ( `no_1` int(11) NOT NULL default '0', `no_2` int(11) NOT NULL default '0', `no_3` int(11) NOT NULL default '0', `no_4` int(11) NOT NULL default '0', `title` char(50) NOT NULL default '', PRIMARY KEY (`no_1`,`no_2`,`no_3`,`no_4`) ) type=myisam DEFAULT CHARSET=euckr; insert into TB_A .. 2007. 6. 4.
핸드폰번호 - 로 분리 select if( length(phone_no)>10 ,concat(substring(phone_no,1,3),"-",substring(phone_no,4,4),"-",substring(phone_no,8,4)) ,concat(substring(phone_no,1,3),"-",substring(phone_no,4,3),"-",substring(phone_no,7,4)) ) han_phone from 테이블명 select case when length(phone_no)<10 then 'min 10' when length(phone_no)=10 then concat(substring(phone_no,1,3),"-",substring(phone_no,4,3),"-",substring.. 2007. 6. 4.
MySQL - Explain 정보보는법 # 이글은 mysql document 의 7.2.1 Explain Syntax 를 대~충 번역한 것입니다. # 틈틈이 번역하고 있으나 언제 완료될지 모릅니다.. EXPLAIN 을 사용함으로써 인덱스가 적절히 사용되고 있는지 검토할 수 있다. 인덱스가 잘못 사용되고 있다면 ANALYZE TABLE 을 사용하여 테이블을 점검하라. 이것은 테이블의 상태를 갱신.. 2007. 6. 4.
my.cnf 입니다. 4G 램 서버에서 어떻게 셋팅 # system variable [shared by all threads] 1. key_buffer_size -> 25% of total memory 2. join_buffer_size 3. table_cache -> check opened_table status [per threads] 1. read_rnd_buffer_size -> improve ORDER BY 2. sort_buffer_size -> improve ORDER BY or GROUP BY if you have lots of memory increase tmp_table_size it will improve advanced GROUP BY mysql 의 memory 에는 per server 당 할.. 2007. 6. 4.
테이블 깨졌을경우 조치...방법 mysql 사용하다 보면 table이 깨졌을 때 조치 방법(MyISAM 테이블만 해당) [참고] 매뉴얼 13.5.2.6. REPAIR TABLE Syntax REPAIR [LOCAL | NO_WRITE_TO_BINLOG] TABLE tbl_name [, tbl_name] ... [QUICK] [EXTENDED] [USE_FRM] mysql> repair table c_member.member_meet; myisamchk --recover 와 동일 mysql> repair table c_member.member_meet quick; 인덱스 트리만 재생성 myis.. 2007. 6. 4.
바이너리 데이터 변환 1. binary log을 TEXT log로 바꾸기 /usr/local/mysql/bin/mysqlbinlog -s file_name-bin.001 > test.txt 2. binary log를 DB에 반영하기. /usr/local/mysql/bin/mysqlbinlog file_name-bin.001 | /usr/local/mysql/bin/mysql -h localhost -uroot -p 3. Text Log를 DB에 반영하기. ls -1 -t -r file_name.[0-9]* | xargs cat | /usr/local/mysql/bin/mysql -h localhost -uroot -p 2007. 6. 4.
[MySQL] time out(wait_timeout) 계산과 설정 * 출처: http://www.linuxchannel.net/docs/mysql-timeout.txt[MySQL] time out(wait_timeout) 계산과 설정 - 작성자 : 김칠봉 <san2(at)linuxchannel.net> - 작성일 : 2003-08-11(보완, 그래프 추가) 2003-08-04 - 내 용 : life time 계산에 의한 wait_timeout 설정 - 수 준 : 초중급 이상 - 키워드 : MySQL, wait_timeout, interactive_timeout, connect_timeout, max_connec.. 2007. 6. 1.
반응형