Magento Database backup Import restore

Source: Internet
Author: User
Tags gz file import database magento website mysql command line phpmyadmin

Magento The Ultimate solution for database backup and migration +3

Category: Magento Tutorial Tags: magento move, Magento database backup, magento replace domain name, Magento transplant 4,355 people Browse

As an e-commerce shopping cart system solution, Magento database structure is quite complex, so that the normal database backup method can hardly be backed up successfully, even if the successful backup, import database is not a simple thing. On the other hand, as a shopping cart system, from a security point of view, backup data every day is no exaggeration. Replacement of the domain name, the replacement of the server is more or less involved in Magento database backup related knowledge. This article by the Sharp wants the foreign trade e-commerce solution to provide, for Magento user summarizes under the database backup, the transplant one scheme.

Magento database backup actually time is very simple thing, there are many similar articles on the net use phpMyAdmin to export the database and add a piece of SQL code at the end of the generated SQL file header to avoid the backup and migration failures caused by foreign keys. In the previous Magento database backup, I also have been in this way, until the company site database more than 1G, can no longer be backed up in this way. First in the Windows environment, it is difficult to find the editor to open more than 1G files, EditPlus and Zend Studio failed, although UltraEdit opened successfully, but probably need a cigarette time, and add SQL code and save the process is quite painful.

Backup Magento Database

After the comparison and attempt of several Magento database backup schemes, the final decision is to use the backups tool tools Magento Background to make a database backup. The database files backed up by this method have several advantages over the files backed up from phpMyAdmin,

    • The SQL file has been automatically compressed into a. gz file, which is relatively small in size. The database of the site is about 1.7G, the compressed GZ file only 87Mb
    • You do not need to open the file to add the first SQL code. Magento The foreign Key association was added automatically when the file was generated

Said so much a bit, the following step by step specific understanding of how to operate. First, go to the Magento built-in Database Backup tool page by following these steps,

System->tools->backups

After entering the page, click the Create Backup button on the right, and wait for the corresponding time to generate a copy of the database backup file according to the database size. As shown in.

According to your current operating system, if it is a Windows environment (most people believe that the system desktop environment), click 7-zip to download the compressed files, and use the Linux desktop environment can download GZ files. After obtaining the file, you can extract the database files through the decompression tool, it is important to note that the extracted files are not file extensions, we need to rename them to the Xxx.sql file. In this way, the preparation for the import is finished (PS: Here the location of the file needs to be recorded, and the path information is required to import the file at the command line). The next step is how to import the file into a new database.

Import Magento Database

After summing up multiple MySQL data import scenarios, the final choice is to import via the MySQL command line tool, rather than using the phpMyAdmin import method on the Web. When importing large database files through phpMyAdmin, it is necessary to take into account the relevant configuration of PHP and Apache, such as the maximum post value, maximum upload value and maximum run time of the script, the author has encountered a "script timeout when importing through PMA, if you want to complete the import, Please resubmit the same file, the import will continue to be "various issues." With the MySQL command-line tool directly, you don't need to take this into account, and the tool is fairly simple to use.

Windows desktop environment can use cmd or MySQL 5.5 Command line client database management tool into the database, the Linux desktop environment and the server can directly use the command lines tool or SSH. After entering the database, select the database you want to import, run the following command,

01

Source/var/www/html/xxx.sql

Depending on your database size, wait for the appropriate time. Here, the Magento backed up database is successfully imported into the new library. The entire import process is also in the final stages. If you have not changed the domain name, and the newly imported library and the original database name is the same, then to this, your new Magento website can open smoothly. So what if the new database name is replaced, or if you change the domain name?

Magento Domain name change operation

The domain name of the shopping cart system is recorded in the Magento Database Core_config_data table, and when the shopping cart is first created, the system will automatically read and place the address of the website to some people in the table. When changing the domain name, you need to modify the records in the table, otherwise Magento cannot recognize the current domain name, resulting in the generated URL address is the old domain address. Modifying the record is very simple, go to phpMyAdmin, select the Web/unsecure/base_url and Web/secure/base_ for the path field in the Core_config_data table The value of the URL and change to the current domain address, avoid the lack of HTTP and the end of the domain name/slash! As shown,

Magento Database backup Import restore

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.