WordPress在数据库中保存了太多信息,导致在服务器之间转移时变得困难,这是其中一些挑战。
还有哪些问题需要注意?
你的工作流程是什么样的?
WordPress在数据库中保存了太多信息,导致在服务器之间转移时变得困难,这是其中一些挑战。
还有哪些问题需要注意?
你的工作流程是什么样的?
我在开发服务器上设置了一个单一的WordPress安装,用于驱动多个域名。插件和主题文件也是共享的,因此升级对于所有博客都是一键式的过程。
我使用Apache VirtualHosts将多个域名映射到相同的文档根目录,并在主要的wp-config.php
中添加一些魔法来动态设置DB_NAME
,基于当前主机(如果需要,我可以发布代码)。
在本地工作时,我只有一个具有root权限的MySQL用户,并将其用于所有我的数据库(不建议在生产服务器上使用!)。
我的本地域名与真实域名相匹配,但带有伪造的TLD。所以在使用example.com
时,我设置了一个VirtualHost example.dev
。
当我准备好上线时,我使用HeidiSQL复制开发数据库,然后替换所有出现的example.dev
为example.com
。
这就是我在WordPress Answers上添加的相同答案。
It's best to import into dev then move the database over to production because when you import it will download all the new media files from production.
In the meantime production has changed(new posts, new comments, etc.)
This would solve your problem of bringing in any changed content.
Before using MySql make a backup of both databases and move the gz database to the production server and upload the dump (change the name of dev if it's the same as production.
INSERT IGNORE INTO `_wp_production_db`.`wp_cool_plugin_options`
SELECT *
FROM `_wp_dev_db`.`wp_cool_plugin_options`
I'm not comfortable with MySql commands so I would go with option 1.
我在本地机器上有一个开发站点,并更改了本地hosts文件,以便对实时服务器(www.example.com)的调用指向本地主机。这样,所有对外部文件(jquery等)的调用仍然有效,而且我不必费心通过数据库更改任何内容。 通过wordpress XML导出和导入内容给我带来了最好的结果。
更新: 我使用了http://www.mertyazicioglu.com/projects/wordpress-move/并取得了良好的结果。
JD