Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogutski/09c1e1c5655105362e754aa6640e6ffd to your computer and use it in GitHub Desktop.
Save bogutski/09c1e1c5655105362e754aa6640e6ffd to your computer and use it in GitHub Desktop.
Bash script for import from local MySQL database to remote DB through SSH
lclDBName="value"
lclDBUser="value"
lclDBPass="value"
RemoteDBName="value"
RemoteDBUser="value"
RemoteDBPass="value"
RemoteHost="localhost"
lclHost="localhost"
RemoteSSHUser="value"
RemoteSSHIP="11.111.111.11"
mysqldump --host=$lclHost --user=$lclDBUser --password=$lclDBPass $lclDBName | ssh $RemoteSSHUser@$RemoteSSHIP mysql --user=$RemoteDBUser --password=$RemoteDBPass --host=$RemoteHost $RemoteDBName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment