일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- Shell
- JSON
- Elasticsearch
- 디렉토리
- Chrome
- 크롬
- Python
- 서울시민카드
- CentOS
- syslog
- K8S
- C
- yum
- 파이썬
- docker
- 빅데이터
- PostgreSQL
- rsyslog
- audit
- log
- Linux
- bash
- zabbix
- centos 7.5
- RHEL
- GPU
- Kubernetes
- Elk
- GNOME
- Audit Log
- Today
- Total
Sysops Notepad
[DB] mysql/mariadb json format export output 본문
mysql/mariadb 리눅스 json 포멧으로 출력하는 방법
# echo "select * from table limit 3;" | mysqlsh --json --sqlc --uri root@ip:3306
{"duration":"0.00 sec","info":"","row_count":3,"rows":[[1,"PENELOPE","GUINESS",{"year":2006,"month":1,"day":15,"hour":4,"minute":34,"second":33.0}],[2,"NICK","WAHLBERG",{"year":2006,"month":1,"day":15,"hour":4,"minute":34,"second":33.0}],[3,"ED","CHASE",{"year":2006,"month":1,"day":15,"hour":4,"minute":34,"second":33.0}]],"warning_count":0}
# echo "select * from table limit 3;" | mysqlsh --json=raw --sqlc --uri root@ip:3306
{"duration":"0.00 sec","info":"","row_count":3,"rows":[[1,"PENELOPE","GUINESS",{"year":2006,"month":1,"day":15,"hour":4,"minute":34,"second":33.0}],[2,"NICK","WAHLBERG",{"year":2006,"month":1,"day":15,"hour":4,"minute":34,"second":33.0}],[3,"ED","CHASE",{"year":2006,"month":1,"day":15,"hour":4,"minute":34,"second":33.0}]],"warning_count":0}
# echo "select * from table limit 3;" | mysqlsh --json=pretty --sqlc --uri root@ip1:3306
{
"duration": "0.00 sec",
"info": "",
"row_count": 3,
"rows": [
[
1,
"PENELOPE",
"GUINESS",
{
"year": 2006,
"month": 1,
"day": 15,
"hour": 4,
"minute": 34,
"second": 33.0
}
],
[
2,
"NICK",
"WAHLBERG",
{
"year": 2006,
"month": 1,
"day": 15,
"hour": 4,
"minute": 34,
"second": 33.0
}
],
[
3,
"ED",
"CHASE",
{
"year": 2006,
"month": 1,
"day": 15,
"hour": 4,
"minute": 34,
"second": 33.0
}
]
],
"warning_count": 0
}
참고 : https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-json-output.html
'업무 > etc' 카테고리의 다른 글
[Linux] 계정별 crontab 설정 보기 (0) | 2018.11.26 |
---|---|
[Linux] screen 사용 방법 (0) | 2018.11.26 |
vi 편집기 단축키 및 명령어 정리 (0) | 2018.11.08 |
docker 자주 사용하는 명령어 및 옵션 (0) | 2018.11.03 |
Jenkins 백업/복구 설정 하기 (0) | 2018.11.02 |