52.数据迁移

来源:互联网 发布:直播破解软件 编辑:程序博客网 时间:2024/06/06 01:36

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 缓存:必须改变prefixmagento 开启 apc cache 将代替 /var/cacheapc 对迁移一无所知,<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.ssh3.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

0 0