Comments on: Ways to export MySQL result set to file on client side https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side Blog by Shlomi Noach Fri, 14 Mar 2014 10:37:25 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: Kishor Pawar https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-233328 Fri, 14 Mar 2014 10:37:25 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-233328 select into outfile is useful when you may want to take incremental backup of a single table.

]]>
By: Shantanu Oak https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-118552 Thu, 13 Sep 2012 12:32:51 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-118552 It is also possible to start mysql with –tee option.
I have saved it as an alias to ~/.bashrc file
alias mysql_new=’mysql –tee=”/home/sqltee.txt”‘

]]>
By: Peter Laursen https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-114848 Mon, 20 Aug 2012 13:36:05 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-114848 @Sheeri ..

I requested the CHARACTER SET option for (not now existing) LOCAL OUTFILE option. If makes perfectly sense to SELECT INTO OUTFILE and specify the encoding of the file different from the client character set.

If I am issuing the commant from a utf8 client I could still want the file encoded in cp1251 or big5, for instance.

]]>
By: Anders Karlsson https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-114042 Wed, 15 Aug 2012 18:23:31 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-114042 Also try my mysqljsonexport that allows you to export MySQL data in JSON format, and you can pass an ad-hoc SQL statement to export, in addition to exporting complete tables. Mysqljsonexport is available on sourceforge

]]>
By: Sheeri https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-114005 Wed, 15 Aug 2012 14:51:35 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-114005 –xml and –html have been in mysqldump for a long time, I think even 4.1 had it.

As for character set, you set the character set you want in your client.

Also, many GUIs don’t need a direct connection, they’ll do an ssh login/tunnel for you.

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-113960 Wed, 15 Aug 2012 09:53:59 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-113960 @Daniel,
Thanks!

@Peter:
Seems like –xml is already present in 5.1 (tested with 5.1.51)

mysqldump –tab=/path/to/files is very old, as well, and have been used by mk-parallel-dump for CSV export.

]]>
By: Peter Laursen https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-113958 Wed, 15 Aug 2012 09:44:57 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-113958 But it would be nice to have “SELECT .. INTO [LOCAL] OUTFILE [CHARACTER SET ..] .. ;”.

The option for XML export by ‘mysqldump’ was added in 5.5 (ported from 6.0). Not sure about CSV. Maybe a 5.6 feature?

]]>
By: Daniël van Eeden https://shlomi-noach.github.io/blog/mysql/ways-to-export-mysql-result-set-to-file-on-client-side/comment-page-1#comment-113957 Wed, 15 Aug 2012 09:39:01 +0000 https://shlomi-noach.github.io/blog/?p=4081#comment-113957 mysqldump can be used to generate output in CSV (comma or tab separated), XML and SQL format.

]]>