Skip to content

JensRantil/mysqlcsvdump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL CSV dumper

image

This is a tiny program that can be used to _remotely dump one, or many, MySQL tables to CSV format. The application was developed out of frustration that mysqldump still (in 2014!!!) can't dump to CSV format without storing the dumped file on the database host.

Why CSV?

Comma-Separated Values (CSV) is a very natural dataformat for relational tables. It's readable by most applications that deals with data (yes, I'm thinking about you, Excel) and it's a natural fit when working with data on the command line (awk, sed, grep etc.).

Likewise, it can also easily be parsed by various scripting languages.

Why is dumping CSV files onto database instances a bad idea?

TLDR; Because unnecessary fiddling on a database machine is generally a bad idea. Hands off database machines if possible.

The longer answer:

First and foremost, I've seen many mistakes being made on database hosts. Dumping to local disk will require you to log into the host, copy files, possibly compress files and delete files. Many of these steps run the risk of disturbing the work of the MySQL instance; IO could get worse or you run the risk of running out of disk space. Heck, you even run the risk of deleting files you did not intend to remove.

To avoid running out of disk space and not drain IO, you could of course mount a separate file system for dumps - but I would rather not do that kind of work on a database instance if not really necessary.

Also, dumping to local disk does not support compression. This utility application does.

How do compile this?

  1. Install a Go compiler.
  2. Set up a Go workspace: mkdir -p ~/src/mysqlcsvdump && export GOPATH=~/src/mysqlcsvdump. See http://golang.org/doc/code.html for more information.
  3. Get: go get github.com/JensRantil/mysqlcsvdump.
  4. Compile and install: go install github.com/JensRantil/mysqlcsvdump.
  5. Execute: ~/src/mysqlcsvdump/bin/mysqlcsvdump -help

Who developed this?

I'm Jens Rantil. Have a look at my blog for more info on what I'm working on.

About

Dumps MySQL tables remotely to CSV. No, mysqldump can't do that.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages