To 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:
mysqldump -h HOST -u USER -p DATABASENAME > output.sql
If HOST is localhost- you can just type:
mysqldump -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.
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:
tar -cvf myarchive.tar *
To use zip:
zip -r myarchive.zip *
Enter both commands in your site’s main directory (public_html, httpdocs, share/www or similar).
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:
wget http://OLDSERVER/myarchive.zip
3. Put the files on your destination server and edit the app/etc/local.xml file. Enter in it access credentials to your new database.
(First try to import without following code if error then put following)
4. Before loading the database file add these before the begginning of your SQL dump 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;
And this after all the contents of this 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;
You can import the database using phpMyadmin (“Import” tab) or mysql tool.
To use mysql tool type:
mysql -h HOST -u USER -p DATABASE_NAME < output.sql
and enter the password when asked.
5. 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:
web/unsecure/base_url
web/secure/base_url
Then edit value of column “value” for both records.
Your Magento should already work on another host.
Information Source: http://de77.com/other/how-to-move-magento-shop-to-another-host
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:
mysqldump -h HOST -u USER -p DATABASENAME > output.sql
If HOST is localhost- you can just type:
mysqldump -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.
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:
tar -cvf myarchive.tar *
To use zip:
zip -r myarchive.zip *
Enter both commands in your site’s main directory (public_html, httpdocs, share/www or similar).
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:
wget http://OLDSERVER/myarchive.zip
3. Put the files on your destination server and edit the app/etc/local.xml file. Enter in it access credentials to your new database.
Change MySQL Database Settings
/app/etc/local.xml
<connection>
<host><![CDATA[localhost]]></ host>
<username><![CDATA[database_ username]]></username>
<password><![CDATA[database_ password]]></password>
<dbname><![CDATA[database_ name]]></dbname>
<active>1</active>
</connection>
------------------------------ -----------------------------
Go to your \app\etc\local.xml,
find default_setup section and add <initStatements> tag with your
query there (or change if it is already present). So, it will look like:
<default_setup>
<connection>
<host><![CDATA[your_host]]></ host>
<username><![CDATA[user]]></ username>
<password><![CDATA[password]]> </password>
<dbname><![CDATA[db]]></ dbname>
<initStatements><![CDATA[SET NAMES 'utf8' COLLATE 'utf8_unicode_ci']]></ initStatements>
<model><![CDATA[mysql4]]></ model>
<type><![CDATA[pdo_mysql]]></ type>
<pdoType><![CDATA[]]></ pdoType>
<active>1</active>
</connection>
</default_setup>
(First try to import without following code if error then put following)
4. Before loading the database file add these before the begginning of your SQL dump 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;
And this after all the contents of this 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;
You can import the database using phpMyadmin (“Import” tab) or mysql tool.
To use mysql tool type:
mysql -h HOST -u USER -p DATABASE_NAME < output.sql
and enter the password when asked.
5. 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:
web/unsecure/base_url
web/secure/base_url
Then edit value of column “value” for both records.
Your Magento should already work on another host.
Information Source: http://de77.com/other/how-to-move-magento-shop-to-another-host
No comments:
Post a Comment