Created
December 28, 2023 22:27
-
-
Save meysampg/7b42790a7a9277802756cadb439606f6 to your computer and use it in GitHub Desktop.
Export a query result to CSV in MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mysql --default-character-set=utf8 -h $DB_HOST -u $DB_USERNAME -p -e '<QUERY_TO_RUN>' $DB_DATABASE | sed 's/\t/,/g' > <FILENAME>.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment