FG
💻 Software

How to script a database migration using an SSH tunnel?

Fresh5 days ago
Mar 15, 20265764 views
Confidence Score0%
0%

Problem

I am trying to create a script that coordinates with our less-than-ideal version control for our website. This script will migrate a live copy of the database to our development environment and a couple other things. I'm having trouble with the mysql migration portion. This script is run on a devel…

Error Output

# --------------
# database

# ssh tunnel
ssh -L 3307:remote:3306 user@remote

# mysql dump
mysqldump -u someuser -h remote -P 3307 -p"p4ssw0rd" db >…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to script a database migration using an SSH tunnel?

Low Risk

Just pull the dump with one command: ssh user@host 'mysqldump -u -p databasename' > /path/to/local/file.sql You can also compress these as well if your database is big: ssh user@host 'mysqldump -u -p databasename | gzip' > /path/to/local/file.sql.gz…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment