Skip to content

Instantly share code, notes, and snippets.

@goreilly
Created October 25, 2016 22:07
Show Gist options
  • Save goreilly/91a20b8e86d03c02f475f1e8b5d2cbc8 to your computer and use it in GitHub Desktop.
Save goreilly/91a20b8e86d03c02f475f1e8b5d2cbc8 to your computer and use it in GitHub Desktop.
Import entire MySQL databases from command live over SSH tunnel
[client]
user=root
password=password
host=127.0.0.1
port=3306
[clientremote]
user=remote_username
password=remote_password
host=127.0.0.1
port=3307
function download_mysql
for db in $argv
mysqldump --defaults-group-suffix=remote --single-transaction -vBC $db | mysql $db
end
end
#!/bin/sh
ssh -L 3307:127.0.0.1:3306 remote_database_server_hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment