티스토리 뷰
https://www.lesstif.com/dbms/mysql-client-query-csv-text-54951965.html
MySQL client query 결과를 csv 나 text 파일로 저장
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
www.lesstif.com
SELECT order_id,product_name,qty FROM orders
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
파일 생성은 된 것 같은데, 파일이 어디에 생성되는지 찾을 수 없다. ㅠㅠ
DB서버에 해당 경로에 파일이 생성된 듯 하나 접근 권한이 없어 해당 방법으로 실패
https://stackoverflow.com/questions/21253704/a-to-save-mysql-query-output-to-excel-or-txt-file
How to save MySQL query output to excel or .txt file?
How do you save output of a MySQL query to a MS Excel sheet? Even if it's only possible to store the data in a .txt file, it will be okay.
stackoverflow.com
mysql -user -pass -e "select cols from table where cols not null" > /tmp/output
//리모트인 경우
mysql -h {아이피} -user -pass -e "select cols from table where cols not null" > /tmp/output
해당 방법으로 처리시 입력한 경로에 정상적으로 파일생성 된 것 확인.!
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- addMonthWithoutOverflow
- aaa패턴
- 메일
- 라라벨
- php
- 테스트_다중트랜잭션
- exception-test
- POP3
- password-manager
- l5-swagger
- Laravel
- eloquent-observer
- addMonth
- session+token authorize
- Python
- vim
- laravel-kafka
- bitwarden-cli
- graphql
- django
- graphql-php
- 정규식
- laravel-test
- 정의
- observer 매개변수 전달하기
- php-laravel
- l5-swagger-response
- MySQL
- 자바스크립트
- redis
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함