使用 Laragon 为本地环境复制 wordpress 数据库

Duplicating wordpress database for local environment using Laragon

我正在尝试创建一个本地开发环境来测试网站的更改。与我合作的网络开发人员有一个带有自动 DevOps 的网站的 gitlab 存储库,其中更改被推送到 production/stage 提交时切断。

我下载了 Laragon 并能够在本地提供页面,然后我将 gitlab 存储库克隆到我的根目录中。

如何获取生产网站数据库的副本,然后使用 laragon 将其连接到我的本地开发环境?我尝试使用 WP 多合一迁移在生产环境中复制数据库,但存在 read/write 限制。

我得到以下建议:"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"。

我无法从 windows 命令行进行 SSH,但我可以使用 Putty 通过 SSH 连接到服务器,但是,我如何才能将文件传输到我的本地 windows机器?如果我登录到我的服务器,文件不会被放置在远程机器的文件系统中的某个地方,所以我将无法在 Laragon 中使用它。

如果您使用的是 Laragon Full,您可以在 Laragon 的终端中使用 ssh/scp 命令。因此,您可以轻松地从远程服务器获取您的-sql-转储。
方法如下:

  1. 打开 Laragon 的终端:
    菜单 > Laragon > 终端
  2. 运行 这个命令:
scp user@your-remote-host:/path-to-your-sql-dump C:/laragon/tmp/your-sql-dump
  1. 将您的 sql-dump 导入您的本地数据库:
mysql -u root -p your-database < C:\laragon\tmp\your-sql-dump

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

就这些了。