mysql execute query from console and export to csv
Hello. To dump a query to csv use this:
mysql –database=database –execute=”select a from b where a>1;” | sed ’s/\t/”,”/g;s/^/”/;s/$/”/;s/\n//g’ > filename.csv
If you enjoyed this post, make sure you subscribe to my RSS feed!
- October 3rd


















Leave a Reply