Database down via terminal

# Terminal window 1
ssh -N -L 13306:mysql:3306 {{app-env-id}}@ssh.{{region}}.frbit.app
# This has no output. Open a new terminal window next.
shell
# Terminal window 2
# 01. Create a dump from the remote database
mysqldump --set-gtid-purged=OFF --no-tablespaces -h127.0.0.1 -P13306 -u{{app-env-id}} -p {{app-env-id}} > fortrabbit-backup.sql

# 02. Import to your local database
mysql -u{{local-db-user}} -p {{local-db-name}} < fortrabbit-backup.sql
shell

# Other development environments

Steps may differ on containerized development environments. It might be required to login to a container or specifically execute a command on the container.

  • Docker
    • docker exec -i {container} … - execute a command
  • DDEV
    • ddev import-db < dump.sql - import a database from host
    • ddev auth - login to the container (first)
    • ddev exec … - execute a command

Found a tpyo?Edit