markdown WP-CLI数据库迁移说明

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown WP-CLI数据库迁移说明相关的知识,希望对你有一定的参考价值。

## Instructions for using WP-CLI to migrate a WordPress DB

##### Export current (local) DB
```TXT
wp db export db.sql
```

##### Copy file from local to server (may need to amend server path if not in html folder)

The example below is for local to remote, simply swap these 2 around for remote to local

```TXT
scp -r db.sql www-data@IP_ADDRESS:/var/www/html
```

##### SSH onto box (should be same connection details as above)

```TXT
ssh www-data@IP_ADDRESS
```

##### Run the WP CLI DB importer
```TXT
wp db import db.sql
```

##### Use --dry-run first to check that changes will be OK in DB

```TXT
wp search-replace old-site-url.co.uk new-site-url.co.uk --dry-run
wp search-replace old-site-url.co.uk new-site-url.co.uk
```

##### Delete imported DB file

```TXT
rm db.sql
```

以上是关于markdown WP-CLI数据库迁移说明的主要内容,如果未能解决你的问题,请参考以下文章

markdown 使用WP-CLI在服务器上存储WordPress文件和数据库。

markdown WP-CLI备忘录

markdown Ubuntu 16.04:LAMP w / NodeJS和WP-CLI

apache_conf 我的`〜/ .wp-cli / config.yml`文件用于将WP-CLI和WP-CLI Valet命令弯曲到我的意愿

sh 使用WP-CLI在服务器上存储WordPress文件和数据库。

markdown 使用更新数据库脚本进行迁移