You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

557 B

MySQL

SSH Tunneling

  • to connect to db via SSH tunnel
$ ssh -L [local port]:[database host]:[remote port] [username]@[remote host]

// example
$ ssh -L 3307:rr-zf81fzm6ija52q623.mysql.kualalumpur.rds.aliyuncs.com:3306 tenghieyik@172.22.4.252
  • dump
sql> database_name < dump.sql

$ mysqldump db_name > backup.sql

// improve export speed
$ mysqldump --add-drop-table --add-locks --database db > db.sql

$ mysql --init-command="SET SESSION FOREIGN_KEY_CHECKS=0;SET UNIQUE_CHECKS=0;" -u root -p < Backup_Database.mysql