Oh! JUN
MYSQL 메타데이터 목록화 본문
메타 데이터란 무엇인가?
"데이터에 대한 데이터로 자료 그 자체가 아닌 자료의 속성 등을 설명하는 데이터"
데이터의 종류가 많아지면서 이를 정리하기 위해 목록화 시킬 필요성을 느꼈다.
순차적 접근(전체 테이터 목록화)
- 장점 : 중요 정보(데이터) 놓칠 가능성이 낮음
- 단점 : 높은 시간 소요 / 높은 트래픽 발생
비순차적 접근(특정 데이터 목록화)
- 장점 : 낮은 시간 소요 / 낮은 트래픽 발생
- 단점 : 중요 정보 놓칠 가능성이 높음
select * from information_schema.schemata (db조회)
select * from information_schema.tables (table 조회)
select * from information_schema.columns (column 조회)
information_schema.schemata => schema_name (db)
information_schema.tables => table_schema (db)
information_schema.talbes => table_name (table)
information_schema.columns => table_schema (db)
information_schema.columns => table_name (table)
information_schema.columns => column_name (columns)
select * from information_schema.schemata;
- schema_name : DB 이름
- DB 이름 목록화
select * from information_schema.tables;
- table_schema : DB 이름
- table_name : TABLE 이름
select * from information_schema.columns;
- table_schema : DB 이름
- table_name : TALBE 이름
- column_name : column 이름
1. 순차적 목록화
select * from information_schema.schemata;
- DB 전체조회
select schema_name from information_schema.schemata;
- DB에서 DB 이름 정보만 조회
select * from information_schema.tables where table_schema='board';
- 테이블에서 DB명 board에 대해서 모든 정보 테이블 조회
select table_name from information_schema.tables where table_schema='board';
- 테이블에서 DB명 board에 대해서 테이블 이름으로 테이블 목록화
select * from information_schema.columns where table_schema='board' and table_name='members';
- columns 목록에서 DB명 board, TABLE명 members에 대한 모든 정보 column 조회
select column_name from information_schema.columns where table_schema='board' and table_name='members';
- columns 목록에서 DB명 board, TABLE명 members인 column 이름 조회
select * from board.members;
- DB명 board, TABLE명 members에 대한 column 조회
2. 비순차적 목록화
'board' DB의 'members' TABLE의 id 컬럼을 목록화 시킬것이다.
select table_name from information_schema.tables where table_schema='board' and table_name like '%mem%';
테이블에서 DB 이름이 'board', TABLE 이름에 mem이 들어가는 TABLE를 조회
select column_name from information_schema.columns where table_schema='board' and table_name='members';
column에서 DB 이름이 'board', TABLE 이름에 members인 column을 조회
select table_name, column_name from information_schema.columns where table_schema='board' and column_name like '%id%';
column에서 DB 이름이 'board', column이름에 id가 포함되는 테이블이름, 컬럼이름을 조회
select id from board.members;
board DB에서 member Table의 id 컬럼을 조회
'웹 해킹 > SQL Injection' 카테고리의 다른 글
MYSQL ERROR-BASED 공격 실습 (0) | 2022.08.18 |
---|---|
ORACLE 메타데이터 목록화 (0) | 2022.08.17 |
ORACLE 순차적 레코드 출력 실습 (0) | 2022.08.14 |
MYSQL 순차적 레코드 출력 실습 (0) | 2022.08.12 |
데이터 조회 공격(환경 분석 실습) (0) | 2022.08.12 |