之前折腾过:
【记录】基于wordpress主题模板Fortuna去搭建网站主页
以及:
【记录】通过wordpress主题Fortuna去配置需要的页面
后,继续去把本地的配置好的环境,迁移到,搬家到在线的wordpress环境去。
在本地(Mac中MAMP中)部署好(wordpress),页面配置完毕后,再去迁移到在线的环境:
http://www.xxx.com
中,具体步骤是:
1.最好备份在线环境中之前的wordpress文件


然后用rz上传到服务器上
2.最好备份在线环境中之前的wordpress的mysql数据库
1 2 | mysqldump -u root -p wordpress > referxxx_wordpress_180321.sql 输入密码,即可开始备份导出 |
然后用rz上传到服务器上
3.导出本地的wordpress的mysql数据库
本地的Mac中的MAMP中,登录phpmyadmin,然后去Export

不过挺奇怪的是:
导出的不是:直接下载对应sql文件,而是输出到console窗口中:

所以只能自己去拷贝出来,然后再去替换:
把:
替换成:

然后又发现好像其中还有localhost,所以又再去替换了:
为:
(后记:可能是此处的操作导致了:对应的主题Theme Options中的配置,都丢失了?)
4.再去导入本地wordpress文件到在线wordpress
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | [root@smartj wwwroot] # ll -lha total 147M drwxr-xr-x 4 www www 4.0K Mar 21 22:11 . drwxr-xr-x 6 root root 4.0K Mar 21 22:09 .. -rw-r--r-- 1 root root 147M Mar 21 22:11 bealzh.com_wordpress_files_180321.tar drwxr-xr-x 3 www www 4.0K Oct 22 15:22 default drwxr-xr-x 6 www www 4.0K Mar 3 16:21 wordpress [root@smartj wwwroot] # rm -rf wordpress/ [root@smartj wwwroot] # cd .. [root@smartj data] # ll total 118780 -rw-r--r-- 1 root root 110804518 Mar 21 21:39 local_MAMP_wordpress_files.zip -rw-r--r-- 1 root root 5351939 Mar 21 21:46 local_MAMP_wordpress_replacedLocalhost_180321.sql drwxr-xr-x 5 mysql mysql 4096 Mar 21 22:08 mysql -rw-r--r-- 1 root root 5452148 Mar 21 22:04 referPonyAi_wordpress_180321.sql drwxr-xr-x 5 root root 4096 Mar 20 20:25 wordpress drwxr-xr-x 2 root root 4096 Mar 21 03:36 wwwlogs drwxr-xr-x 3 www www 4096 Mar 21 22:11 wwwroot [root@smartj data] # mv wordpress/ wwwroot/ [root@smartj data] # ll total 118776 -rw-r--r-- 1 root root 110804518 Mar 21 21:39 local_MAMP_wordpress_files.zip -rw-r--r-- 1 root root 5351939 Mar 21 21:46 local_MAMP_wordpress_replacedLocalhost_180321.sql wxr-xr-x 5 mysql mysql 4096 Mar 21 22:08 mysql [6n-r--r-- 1 root root 5452148 Mar 21 22:04 referPonyAi_wordpress_180321.sql drwxr-xr-x 2 root root 4096 Mar 21 03:36 wwwlogs drwxr-xr-x 4 www www 4096 Mar 21 22:12 wwwroot [root@smartj data] # cd wwwroot/ [root@smartj wwwroot] # ll total 149728 -rw-r--r-- 1 root root 153308787 Mar 21 22:11 bealzh.com_wordpress_files_180321.tar drwxr-xr-x 3 www www 4096 Oct 22 15:22 default drwxr-xr-x 5 root root 4096 Mar 20 20:25 wordpress [root@smartj wwwroot] # chown -R www wordpress/ [root@smartj wwwroot] # ll -lha total 147M drwxr-xr-x 4 www www 4.0K Mar 21 22:12 . drwxr-xr-x 5 root root 4.0K Mar 21 22:12 .. -rw-r--r-- 1 root root 147M Mar 21 22:11 bealzh.com_wordpress_files_180321.tar drwxr-xr-x 3 www www 4.0K Oct 22 15:22 default drwxr-xr-x 5 www root 4.0K Mar 20 20:25 wordpress |
5.再去导入处理后的数据库到在线wordpress
用rz上传sql到在线环境中,删除旧的数据库,重新创建对应wordpress的数据库:
1 2 3 4 | mysqldump -u root -p 输入密码 drop database wordpress; create database wordpress; |
然后再去还原数据库:
1 | mysql -u root -p wordpress < local_MAMP_wordpress_replacedLocalhost_180321.sql |
6.修改wp-config.php为对应的配置:
1 2 3 4 5 6 7 8 | /** WordPress数据库的名称 */ define( 'DB_NAME' , ‘yourMysqlForWordpress'); /** MySQL数据库用户名 */ define( 'DB_USER' , ‘yourMysqlUser'); /** MySQL数据库密码 */ define( 'DB_PASSWORD' , ‘yourPassword'); |
最后才可以正常访问在线的wordpress网站
转载请注明:在路上 » 【记录】把本地环境的wordpress迁移到在线环境中