How to backup a remote MySql table to a spreadsheet (Excel, Calc, etc)

The other day, one of our customers asked for a spreadsheet export of the data he has stored in our MySQL database. One very easy way to export a remote database’s table to a spreadsheet is with using the -B commandline option:

mysql -h<remote database URL> -u<username> -p<password> <databasename> -e “SELECT * FROM whateveryourtableiscalled” -B > export.tsv

The -B option makes MySQL export to a Tabs Seperated format, which afterwards can easily be imported into Calc or Excel spreadsheets. Have fun!