I’ve gleaned this info from the Magento forums and from activecodeline.com which has now gone offline.
Thanks to Branko for his original post. (If you see this I hope it was ok to re-post but I could get in touch because your site went offline!). I was able to grab it from Google Cached.
I’m posting it here just for my own notes and to help anyone else struggling with moving Magento from on server to another.
Moving Magento from one domain or server to another
Export using default settings of phpMyAdmin.
Moving a database should be a simple two step process.
Step 1: Export your database to a file.
Step 2: Import your database from a file to new MySQL server.
Now doing it for Magento
First, make a backup of entire Magento database with all the default phpMyAdmin options.
Backup your database to .sql file.
Let’s suppose your development site is located at http://dev.site.com and your live site is located at http://livesite.com.
Second step for you would be to open the backup file you created at first step and do Search/ReplaceAll from “dev.site.com” to “livesite.com”.
Magento stores complete url paths inside the database. Therefore you’ll end up with database full of url paths. My backup file had total of 17300 occurrences of “dev.site.com”.
If you search/replaced your .sql file do not rush to import it.
If you try to import file as is, you’ll most likely get some errors from MySQL concerning foreign key constraint an so on.
Important steps
Place these lines of SQL code on very top of the .sql file:
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT; SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS; SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION; SET NAMES utf8; SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'; SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;
Place these lines of SQL code on very end of the .sql file:
SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT; SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS; SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION; SET SQL_NOTES=@OLD_SQL_NOTES;
Now you’re ready to import your .sql file to live MySQL database.
I suggest you ZIP your .sql file and then do import of .zip file trough phpMyAdmin.
Your upload will be faster.
For example my .sql file was 4MB in size while .zip was 300KB. During the import you should not get any error messages.
Ok, for now you should have copied entire root folder content of your Magento from dev.site.com to root folder of livesite.com. There is only one more thing to do before you can open you’re page in browser.
Having in mind that the root of your Magento is http://livesite.com you now need to open http://livesite.com/app/etc/local.xml file and modify it’s database connection information accordingly to your new database in livesite.com.
Save the changes open your browser to livesite.com.
Your Magento should be working!
Extra notes
This guide should get you up n running if you’re moving you’re site from one hosting to another.
There are few more things to keep in mind it the site is not working.
First you need to check folder write permissions through FTP.
Folders like /app, /app/etc, /var, /var/log, /var/session and so on, need to have appropriate access rights (755, 775, 777). Play around with it. There is one more thing that can cause problems. That is .htaccess file. If you’re moving a file from one site to another, and dumping it into same folder, then you probably won’t need to change this. But if you’re dumping it into some sub folder like http://livesite.com/store/ then you’ll have to write following into .htaccess file “RewriteBase /products/” and don’t forget your .sql Search/replace all to set it now replace of “http://dev.site.com” with “http://livesite.com//products/” since you’re dumping Magento into sub folder.