Daniel Taki
Daniel Taki

Reputation: 103

Duplicating wordpress database for local environment using Laragon

I'm trying to create a local development environment to test website changes out in. The web developers I'm working with have a gitlab repo of the website with auto DevOps where changes are pushed to the production/stage sever when commited.

I downloaded Laragon and was able to serve pages locally, then I cloned the gitlab repo into my root directory.

How do I get a copy of production website's database and then connect it to my local development environment with laragon? I tried to duplicate the database on production with WP all-in-one migration but there are read/write restrictions.

I was advised the following: "I would recommend copying the database onto your local MariaDB/MySQL server the Laragon provides. You'd need to get a dump of the database from the server using SSH command line tools and then you can use the phpMyAdmin interface provided by Laragon to upload the dump".

I wasn't able to SSH from the windows command line, but I could SSH into the server using Putty, however, how am I able to transfer the file to my local windows machine? If I'm logged into my server wouldn't the file just be placed somewhere in the file system of the remote machine, so I wouldn't be able to use it with Laragon.

Upvotes: 0

Views: 1417

Answers (1)

Leo Khoa
Leo Khoa

Reputation: 967

If you are using Laragon Full, you have ssh/scp command in Laragon's Terminal. So you can get your-sql-dump from your remote server easily.
Here's how:

  1. Open Laragon's Terminal:
    Menu > Laragon > Terminal
  2. Run this command:
scp user@your-remote-host:/path-to-your-sql-dump C:/laragon/tmp/your-sql-dump
  1. Import your sql-dump to your local database:
mysql -u root -p your-database < C:\laragon\tmp\your-sql-dump

Reference: https://laragon.org/download/migrate-from-xampp.html

That's all.

Upvotes: 1

Related Questions