Puling MYSQL DB from Production to Sandbox (WordPress)


#1

Hey,

I finally got my Sandbox working. Super happy :).

I’ve been tinkering a bit, but no success so far.

Has anyone managed in the Sandbox Build Commands to SSH into their production server, grab the database with WP CLI and dump it in the sandbox?

Curious to hear tips/tricks. I’m a front-end dev and CLI is not my strong suit :man_shrugging:t2:


#2

hey Chris,
what you need to do is:

  1. ssh to your server and run
    https://developer.wordpress.org/cli/commands/db/export/
  2. fetch the exported file with ssh
  3. in the sandbox, run https://developer.wordpress.org/cli/commands/db/import/

make sure the import is run in post-build commands so that the database server is already available in the sandbox.