Skip to content

Instantly share code, notes, and snippets.

@sahilsk
Last active January 5, 2016 08:20
Show Gist options
  • Save sahilsk/65d0ce6ef17a02c38cf5 to your computer and use it in GitHub Desktop.
Save sahilsk/65d0ce6ef17a02c38cf5 to your computer and use it in GitHub Desktop.
Mysql db dump remotely

Instructions

Export

  • Create tunnel

      ssh -f -L3310:localhost:3306 user@remote.server -N
    
  • Test connection

      telnet localhost 3310
    
  • Connect with mysql

      mysqldump -P 3310 -h 127.0.0.1 -u mysql_user -p database_name table_name --result-file=dump_timestamp.sql
    

Import

	mysql -u root -p < dump_timestamp.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment