Magento Data Migration Tool – Fix Undefined Index Exception

errormagento-1.9magento2magento2-migration-toolmigration

I've successfully installed Data migration tool.

I have a magento 1.9.1.0 and magento 2.1.3 runing locally on MAMP under OSX Sierra.

The magento 1 is running under htdocs/magento1 and magento 2 is running in htdocs/magento2, so I access to them with localhost:8888/magento1 and localhost:8888/magento2.

The database name in magento1 is hello and the database name in magento 2 is hello-test, none of them use prefixes.

When I try to do a migration from magento 1 to magento 2 I get an error:

[Exception] Notice: Undefined index: name in /Applications/MAMP/htdocs/magento2/vendor/magento/data-migration-tool/src/Migration/ResourceModel/Adapter/Pdo/MysqlBuilder.php on line 82

The configxml that I configured is:

<source>
    <database host="localhost:8888/magento1/" user="root" password="1234"/>
</source>
<destination>
    <database host="localhost/magento2/" user="root" password="1234"/>
</destination>
<options>
    <crypt_key><![CDATA[abcd1234]]></crypt_key>
</options>

And the command I use to init the migration is:

php bin/magento migrate:settings /Applications/MAMP/htdocs/magento2/vendor/magento/data-migration-tool/etc/ce-to-ce/1.9.1.0/config.xml

What can be failing? I've been searching in google for a while but I find nothing…

Edit: I passed the xml in a xml validator and I see some errors:

this line <database host="localhost:8888/magento1/" user="root" password="1234"/>
display the error cvc-complex-type.4: Attribute 'name' must appear on element 'database'.

this line <database host="localhost:8888/magento2/" user="root" password="1234"/>
display the error cvc-complex-type.4: Attribute 'name' must appear on element 'database'.

and this xml reference to ../../config.xsd and this file displays the error InvalidRegex: Pattern value '[-/A-Za-z0-9\._]+\.(xml|dist)' is not a valid regular expression. The reported error was: ''-' is an invalid character range. Write '\-'.'.
on this line <xs:restriction base="xs:string">

edit 2:
if change the config.xml to

<source>
    <database host="127.0.0.1:8888/magento1/" name="hello" user="root" password="1234"/>
</source>
<destination>
    <database host="127.0.0.1:8888/magento2/" name="hello-test" user="root" password="1234"/>
</destination>

then the error is:

  [Zend_Db_Adapter_Exception]                       
  SQLSTATE[HY000] [2002] No such file or directory  

  [PDOException]                                    
  SQLSTATE[HY000] [2002] No such file or directory  

Best Answer

Install a sane development environment first: http://devdocs.magento.com/guides/v2.1/extension-dev-guide/build/optimal-dev-environment.html

Then follow the data migration docs: http://devdocs.magento.com/guides/v2.0/migration/migration-tool.html

I.e.: I don't see the encryption key wrapped in cdata there.

But your actual error is that you forgot to put the database name as in:

<database host="127.0.0.1" name="magento1" user="root"/>
Related Topic