Moving Magento to a new server

Moving magento to a new server it is very simple but very careful about some changes.Please follow my step hope it will work properly.

Export your database all tables are included from current phpmyadmin. suppose your development site is located at http://example.com and your live site is located at http://yourdomain.com.
Now open your exported .sql database, at first step and do Search/ReplaceAll from “example.com” to “yourdomain.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 more than 100000 occurrences of “example.com”. Huge number.
If you finish searching/replacing 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. I lost about 3 hours of mine time testing and checking things out to get around this. Here’s how. Open your .sql backup file again in your favorite editor and do the following 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;
Before I uploaded the physical files to the new server, I had to change the database name, username and password. These information’s were easy to change, since they’re stored in the file  /app/etc/local.xml
After changing the config-files, I emptied the following folders:
/var/cache/
/var/session/
Solved all of problems, and now the database can import without any trouble
Hope it will work.