A quick how-to if you want to copy or move Magento to another database instance, e.g. to create a test site, or move test to live.
(1) Backup Magento using the built in backup tool. Download and uncompress the resulting SQL script. If changing the server or domain, search and replace “old.mysite.com” with “new.yoursite.com” Execute it to populate the new database instance.
(2) Copy all Magento files with the exception of the contents of the var/ directory.
(3) Edit app/etc/local.xml on the target instance and change the database, user and password, but not the encryption key. Also edit downloader/pearlib/pear.ini to correct the absolute paths it contains; no reason why these shouldn’t be relative to the Magento root directory, e.g. “./downloader/pearlib”.
(4) Execute the following SQL to prevent those nasty “Integrity constraint violation: 1062 Duplicate entry” errors from the log files when adding to the basket:
TRUNCATE `log_customer` ;
TRUNCATE `log_quote` ;
TRUNCATE `log_summary` ;
TRUNCATE `log_url` ;
TRUNCATE `log_url_info` ;
TRUNCATE `log_visitor` ;
TRUNCATE `log_visitor_info` ;
TRUNCATE `log_visitor_online` ;
Now tidy up permissions:
chmod o+w var var/.htaccess app/etc
chmod -R o+w media
That should be it.
Leave a Reply