본문 바로가기
728x90
반응형

It33

[MySQL] 외부접속 허용하기 현재 사용되는 서버의 MySQL에 접속하기 위해서는 모든 IP에서 접속을 할 수 있도록 설정해야 합니다. 1. 설정 확인 mysql> SELECT Host FROM mysql.user WHERE user='root'; query문을 통해 HOST설정을 확인한다. %는 모든 IP의 접속을 설정한다는 것입니다. query문 확인 시 %가 설정 되어 있을 경우 다음 순서는 넘어가도 됩니다. 2. 모든 IP 접속 허용 mysql> INSERT INTO mysql.user (host,user,password) VALUES ('%','root',password('패스워드'));mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';mysql> FLUSH PRIVILEGES; 위에 q.. 2015. 6. 30.
auto_increment initialization (초기화) auto_increment를 이용하여 DB에 데이터를 쌓다보면 auto_increment가 어마어마하게 쌓여있는걸 볼수 있다. tabel을 초기화할 경우 auto_increment도 초기화를 해야 할 경우가 있다. alter table '테이블명' auto_increment = 1 위의 sql문을 이용하여 auto_increment를 초기화 하고 사용하면 된다. 2015. 6. 30.
[MySQL] 컬럼 & 필드 합치기 concat(), group_concat() concat() ex ) concat(column, column) item_table​idx category1category2 category3 5 1 2 3 select idx, concat(category1, "/", category2, "/", category3) as merge_column from item_table where idx = 5 idx merge_column 5 1/2/3 group_concat() ex) group_concat(field saparator '구분자') item_table idx category 5 1 5 2 5 3 select idx, group_concat(category saparator '/') as group_concatfrom item_tablewhere .. 2015. 6. 30.
[MySQL] 문자 치환하기 REPLACE() REPLACE(field, '수정 전', '수정 후'); ex)update 테이블 set 컬럼=replace(컬럼 ,'수정 전','수정 후');update coordi_type_table set coordi_type=replace(coordi_type, 'a' , 'b' ); coordi_type_table coordi_type (치환 전) coordi_type(치환 후) a b 2015. 6. 30.
728x90
반응형