MySQL Dump to another server
Recently – while doing some work for COR.org – I was asked how to dump a database from one server to another… (mysql)
The first thought was to run mysqldump dump on the destination machine, and to access the database over the network. That however, doesn’t compress or encrypt the data. Plus I would have had to create a mysql user with permission to access the database remotely.
The solution used instead worked out well: mysqldump directly to the remote host with this command:
mysqldump <DATABASE_NAME> [mysqldump options] | gzip -c | ssh user@remotehost "cat > /path/to/some-file.sql.gz"
In short – this method pipes the mysqldump command through gzip, then to through and SSH connection. SSH on the remote side runs the ‘cat’ command to read the stdin, then redirects that to the actual file where you want it saved.
Pages
Tags
apple Archived asperger's autism blogging cat6 Chatter Church cisco citrt comcast convention cPanel datacenter debugging mysql devil evangelism facebook faith family iPad iPhone iscsi Leadership Linux MAC Marketing Microsoft MySQL network Off the wall crazy OpenSource or just weirdly different pfsense politics Ramblings review Security skype Sprint Storage Technology Web 2.0 minus or plus Wifi wisp


Place your comment