Clone-a-database one-liner

I had to clone a remote MySQL database into my Ubuntu notebook, and I just felt like doing a one-liner for it.

$ mysqladmin -f -uroot create sandbox &&
ssh luisfarzati@mydatabasehost.com "mysqldump -uroot sandbox | gzip -f" | gunzip | mysql -uroot sandbox

Leave a comment