Because if I use that crypt_key from magento 1 and try to migrate another database, data-migration-tool runs and start to migrate that db.
Why is this happening?
What are the reasons to use that crypt_key?
crypt_key is used for encryption of sensitive information of site. eg. customer password
When you migrate data from magento 1 to magento 2, you must need to define <crypt_key>
field in config.xml file.
crypt_key convert encoded value of Magento 1 to value compatible with Magento2.
when you run migrate command, magento 2 data migration tool check data validation from Encrypt.php file, You can check file,
vendor/magento/data-migration-tool/src/Migration/Handler/Settings/Encrypt.php
Inside Handle()
function you can check $this->validate($recordToHandle); function for validate of old data for crypt_key.
public function validate(Record $record)
{
if (empty($this->cryptKey)) {
throw new Exception("\"crypt_key\" option is not defined the configuration.");
}
parent::validate($record);
}
if you haven't defined crypt_key in config.xml file, data validatin throws error from above file.
So using crypt_key, Magento system use crypt key with encoding mechanism to encode sensitive information of users to store in db.