I'd like to avoid mysqldump since that outputs in a form that is only convenient for mysql to read. CSV seems more universal (one file per table is fine). But if there are advantages to mysqldump, I'm all ears. Also, I'd like something I can run from the command line (linux). If that's a mysql script, pointers to how to make such a thing would be helpful.
Mysql – Dump a thesql database to a plaintext (CSV) backup from the command line
backupcommand linecsvMySQL
Related Topic
- Mysql – How to get a list of user accounts using the command line in MySQL
- Postgresql – Restore a postgres backup file using the command line
- Bash – How to reload .bash_profile from the command line
- Windows – List all environment variables from the command line
- Mysql – How to get the sizes of the tables of a MySQL database
- Mysql – Downloading MySQL dump from command line
- Mysql – How to import an SQL file using the command line in MySQL
Best Answer
If you can cope with table-at-a-time, and your data is not binary, use the
-B
option to themysql
command. With this option it'll generate TSV (tab separated) files which can import into Excel, etc, quite easily:Alternatively, if you've got direct access to the server's file system, use
SELECT INTO OUTFILE
which can generate real CSV files: