
Magento 1 is the legacy version of the popular e-commerce platform that powers thousands of online stores around the world. However, Magento 1 will reach its end of life in June 2020, meaning that it will no longer receive security updates or support from Adobe. This poses a serious risk for Magento 1 store owners, as their sites may become vulnerable to cyberattacks, performance issues, and compatibility problems. That’s why it’s crucial to perform Database Migration from Magento 1 to Magento 2, the latest and most advanced version of the platform.
Magento 2 offers many benefits over Magento 1, such as:
• Improved performance and scalability
• Enhanced security and compliance
• Modern and responsive design
• Rich and user-friendly features
• Easy and flexible customization
• Seamless integration with third-party services
But how do you perform database migration from Magento 1 to Magento 2 without losing your data, functionality, and SEO ranking? The answer is to use the Data Migration Tool, a command-line interface tool that helps you transfer your database from Magento 1 to Magento 2 in a fast and reliable way. However, we are ready to learn and use the Data migration tool, We will have to perform some prerequisite steps.
Prerequisites: Database Migration from Magento 1 to Magento 2
Before starting with the Data Migration tool and Data Migration from Magento 1 to Magento 2 itself, we need to follow the steps below to ensure safe and smooth migration:-
- We will be using a Local setup for Magento 1 and Magento 2 to perform safe data migration. So the first step will be to create Magento 1 and Magento 2 websites on your local.
- To speed up the migration process we would want to remove the unwanted data from the Magento 1 Database. We will truncate a few tables that contain unwanted data. Aside from the tables listed below you should also check other tables that can be safely truncated to reduce the data import time as it can take quite a while to be completed.
//unwanted log tables
truncate table log_customer;
truncate table log_quote;
truncate table log_summary;
truncate table log_summary_type;
truncate table log_url;
truncate table log_url_info;
truncate table log_visitor;
truncate table log_visitor_info;
truncate table log_visitor_online;
//unwanted core tables
truncate table core_cache_tag;
truncate table core_cache;
truncate table core_session;
- Manually copy all of the media files such as categories, products, WSIYWIG editor, and more from your {{Magento 1 installation directory}}/media to {{Magento 2 installation directory}}/pub/media. Make sure to not copy the .htaccess file from Magento 1 as Magento 2 has its own .htaccess file.
- To copy all the data successfully we will use the fresh Magento 2 database as in some cases not all data get copied over.
The Data Migration Tool is a command-line interface (CLI) tool that helps you transfer data from Magento 1 to Magento 2. The tool verifies the consistency between the database structures of the two versions, tracks the data transfer progress, creates logs, and runs data verification tests.
The Data Migration Tool splits the migration process into three modes:
• Settings Mode: migrates the system configuration and website-related settings.
• Data Mode: migrates database assets in bulk, such as products, customers, orders, etc.
• Delta Mode: migrates incremental changes that occurred in Magento 1 after the Data Mode, such as new customers and orders.
The tool also uses XML map files to define the rules and connections between the data structures of Magento 1 and 2. The map files can be customized to account for any differences or customizations in your Magento 1 database.
Migrating database from Magento 1 to Magento 2 is a vital step for any online store owner who wants to stay ahead of the competition and provide a better shopping experience for their customers. However, performing Database Migration from Magento 1 to Magento 2 can be a challenging and complex task that requires careful planning and execution.

The Data Migration Tool works by connecting to your Magento 1 and Magento 2 databases and mapping the data between them. It also validates the data integrity and applies the necessary transformations to make it compatible with Magento 2.
To use the Data Migration Tool, you need to follow these steps:-
Install Data Migration Tool
In order to install the data migration tool you need to first determine your Magento 2 version because you will have to download the same compatible version for the migration tool. To check your Magento 2 version run the below command on your root directory:-
php bin/magento --version
//Output
Magento CLI 2.4.6
Once the Magento version is determined you change the RELEASE Notes for the compatible version and can install the Data Migration Tool on your Magento 2 instance by running the following command:-
composer require magento/data-migration-tool:2.4.6
//To overcome memory issues, alternatively you can run the below command
COMPOSER_MEMORY_LIMIT=-1 composer require magento/data-migration-tool:2.4.6
Configure Data Migration Tool
Configure the Data Migration Tool by editing the config.xml file and specifying the source (Magento 1) and destination (Magento 2) database credentials and settings.
- First of all, login to the Magento 1 admin panel and check the version which should be at the footer section of your admin panel pages as shown below:-

- Once you know the version number, go to your Magento 2 root directory and go to folder vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.4.3/
- Copy and paste config.xml.dist, and rename it to config.xml. Your directory will look like below with additional file config.xml

- Open config.xml and search for source and destination, in source, add Magento 1 DB credentials and destination add Magento 2 DB credentials

- In the same config.xml, look for crypt_key under options add crypt_key from Magento 1 which can be found under app/etc/local.xml in your Magento 1 instance. After adding it should look like the below image:-

Run the Data Migration Tool
Now we will run the Data Migration Tool by executing the following steps( Make sure that Magento 1 version may vary for you, please change the command mindfully):-
- Run DB import for our core config settings. You can import core config settings using the following command:-
php bin/magento migrate:settings vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.4.3/config.xml
- Run DB import for our data. You can now import data using the following command:-
php bin/magento migrate:data -a -r vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.4.3/config.xml
- In case you have a huge amount of data and it stops the import in between then you can run the following command and it will restart from where it stopped
php bin/magento migrate:delta vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.4.3/config.xml
Run Usual commands and Indexers
Once the process is complete run the usual Magento commands and indexers:-
php bin/magento maintenance:enable &&
php bin/magento setup:upgrade &&
rm -rf generated/* &&
php bin/magento setup:di:compile
&& rm -rf pub/static/* &&
php bin/magento setup:static-content:deploy -f en_GB en_US
&& php bin/magento cache:enable
//Once done run the indexers
php bin/magento indexer:reindex
Monitor and Resolve any Issues
Verify the migration results by checking your Magento 2 site and ensuring that all your data is transferred correctly. Also, check the migration log for any errors by going into /var/migration.log.
Conclusion
That’s why using the Data Migration Tool is a smart and efficient way to migrate your database from Magento 1 to Magento 2 without losing any information or functionality. The Data Migration Tool helps you transfer your settings, data, and delta from Magento 1 to Magento 2 in a fast and reliable way.
Note:- If you have two Magento 2 stores and you want to merge them then you can check out our Data Merging blog to learn more about the process.
If you need any help or guidance with migrating database from Magento 1 to Magento 2, feel free to contact us. We are a team of Magento experts who can help you with any aspect of your Magento migration project. We can help you with:
• Planning and strategy
• Database migration and testing
• Theme and extension development and customization
• SEO and performance optimization
• Support and maintenance
We are ready to help you to perform Database Migration from Magento 1 to Magento 2 and take your online store to the next level. Contact us today and get a free quote for your Magento migration project.






