52.数据迁移

Step1 : Mysql Dump

1.导出到远程主机
mysqldump -h oldhost -u oldusername -poldpassword --single-transaction olddbname | mysql -h newhost -u newusername -pnewpassword newdbname
2.导出到本地
mysqldump -h DBHOST -u DBUSER -pDBPASS --single-transaction DBNAME > data.sql

这里写图片描述


STEP2 : Transfer all Magento Files

2.Media Directory


STEP3 : Adjust the Magento Configuration

<host><![CDATA[HOSTNAME]]></host>
<username><![CDATA[USER]]></username>
<password><![CDATA[PASSWORD]]></password>
<dbname><![CDATA[DATABASENAME]]></dbname>

3.config file

!!!如果使用了 apc 缓存:必须改变prefix
magento 开启 apc cache 将代替 /var/cache
apc 对迁移一无所知,<prefix> 将告诉它属于哪个网站
Important note about caching! If you are using apc caching (<cache><backend>apc</backend> in local.xml)
 and are creating a copy of the installation on the same server, you MUST change the <cache><prefix> 
 setting to a new value. The reason for this is that if apc cache is used, magento will save all cache entries 
 in the apc itself instead of /var/cache directory. And the apc cache storage is the same
  for the whole server, it knows nothing about installations, and <prefix> setting is the only 
  thing that can tell it which website each cache entry belongs to. If you have two sites running with the 
  same prefix, some very strange and hard-to-find errors may occur like data from one shop appearing 
  in another shop’s menus, spontaneous redirects to the other shops’ url in back-end, 
  changing of settings in backend affecting the other installation etc, etc.

4.Copy Files

1.wget http://www.example.com/backup/local.xml
...

安全的做法:
2.ssh
3.scp -r username@example.com:/home/username/public_html/backup .

5.update data

path:                       value:
web/unsecure/base_url       http://[you_domain_here]/
web/secure/base_url         https://[your_secure_domain_here]/

with multiple stores you need also change:

path:                          value:
web/unsecure/base_url          http://[you_domain_here]/
web/secure/base_url            https://[your_secure_domain_here]/
web/unsecure/base_link_url     http://[your_domain_here]/
web/unsecure/base_skin_url     http://[your_domain_here]/skin/
web/unsecure/base_media_url    http://[your_domain_here]/media/
web/unsecure/base_js_url       http://[your_domain_here]/js/
web/secure/base_link_url       https://[your_secure_domain_here]/
web/secure/base_skin_url       https://[your_secure_domain_here]/skin/
web/secure/base_media_url      https://[your_secure_domain_here]/media/
web/secure/base_js_url         https://[your_secure_domain_here]/js/
select * from core_config_data where path = 'web/unsecure/base_url';


select * from core_config_data where path = 'admin/url/custom';

select * from core_config_data where path = 'web/secure/base_url';


6. !!! Delete the cache data !!!


7.Can’t login to Magento admin after migration

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

http://magento.stackexchange.com/questions/64967/cant-login-to-magento-admin-after-migration


8.Using a Custom Admin URL

http://docs.magento.com/m1/ce/user_guide/configuration/url-admin-custom.html


https://magento2.atlassian.net/wiki/display/m1wiki/Moving+Magento+to+Another+Server

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值