Another straight to the point solutionTo successfully move a Magento store to another host (including localhost) you can just follow the steps above.
1. Dump MySQL database
If you have installed phpMyAdmin- use it. It's the easiest and fastest way. Go to "Export" tab and select a checkbox named "Save as file".
If the database is really big or you don't have phpMyAdmin installed and don't want to install one, but you have SSH access to the server- then you can use mysqldump tool. The syntax is as follow:
If HOST is localhost- you can just type:mysqldump -h HOST -u USER -p DATABASENAME > output.sql
After you type this command you will be asked for a password and the process will begin. Grab the output file using for example FTP.mysqldump -u USER -p DATABASENAME > output.sql
If you have cPanel, Plesk, DirectAdmin or any other web hosting management tool- you can look at the available options. Many panels allow you to dump the database with just a few clicks. For example cPanel does have an option for this.
2. Copy files
Quite a hard task, because Magento has really a lot of files. You can copy them using FTP, but make sure to enable in your FTP client copying of many files at the same time (for example 5). This will speed up the process a bit, but it can still take a few hours.
If you have SSH access you can log on your server and try to zip/tar all the files.
To use tar type:
To use zip:tar -cvf myarchive.tar *
Enter both commands in your site's main directory (public_html, httpdocs, share/www or similar).zip -r myarchive.zip *
Now you can copy the archive using even FTP. You can also use wget to get it onto another server. Enter this command on the destination server:
3. Change MySQL configuration file
Edit the app/etc/local.xml file. Change in it access credentials to your new database.
4. Import MySQL database
Before loading the database file add these before the begginning of your SQL dump file:
And this after all the contents of this file:SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; 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;
You can import the database using phpMyadmin ("Import" tab) or mysql tool.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;
To use mysql tool type:
and enter the password when asked.mysql -h HOST -u USER -p DATABASE_NAME < output.sql
5. Change old domain name to new one in Magento's configuration
If your Magento is going to work on another domain you need to enter new domain's name in the database.
Go to table named core_config_data and loof for records with these values in "path" column:
Then edit value of column "value" for both records.web/unsecure/base_url web/secure/base_url
Your Magento should already work on another host.