We had to move about 30 databases from one server that had run out of drive space to another server with enough drive space to last us a couple years (at current growth). The problem is that the old server didn't have enough space for the dump files (shutting down the server for the duration of the maintenance wasn't an option, so we couldn't copy of the database files) so we had to figure out a way to move them using mysqldump.

Enter SSH

I love how easy SSH can make things. The quick fix for this problem was for us to pipe mysqldump's output into SSH and then restore them on the remote server.

mysqldump -u username -p database | gzip -c | ssh username@hostname 'cat > ~/database.sql.gz'

We could have dumped the dump directly back to MySQL but because restoring these databases took upwards of an hour we found it easier to move them all over, run a script to restore them all, go home for the weekend, and look for errors on Monday.