0

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  
0

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"/>
  • I already read and followed the migration tool guides, the encryption key in a cdata or without cdata doesn't change anything. I enabled the developer mode in magento 2, now I get the error '[Migration\Exception] XML file is invalid.' instead the error I got before. – Alex Apr 20 '17 at 9:32
  • Well according to the error it doesn't find the index name wherever it is looking for it. I suspect you either missed a configuration step or misconfigured. If you get an XML invalid error that might likely be the cause. Try checking the xml in an online validator. You probably put illegal characters. – steros Apr 20 '17 at 9:45
  • I passed a xml validator and updated the question with the result, the config.xsd that gives an invalid character error remains untouched since the installation – Alex Apr 20 '17 at 9:51
  • I've updated my answer – steros Apr 20 '17 at 10:00
  • I removed the names before because I understood in the documentation that the name is required only if you use the prefix magento1 in the database, and I'm not using any prefix. If I write the dataase names here the error changes to [Zend_Db_Adapter_Exception] SQLSTATE[HY000] [2002] No such file or directory and [PDOException] SQLSTATE[HY000] [2002] No such file or directory – Alex Apr 20 '17 at 10:05
0

I found the solution. I'm going to explain it here because maybe in the future it helps somebody:

1.- enter in the magento 2 folder.

2.- type in terminal php -i | grep 'php.ini'

3.- if you get

Configuration File (php.ini) Path => /usr/local/etc/php/5.6
Loaded Configuration File => /usr/local/etc/php/5.6/php.ini

then it is failing because of that, you are using php from OSX and not from MAMP

4.- edit ~/.profile (ie. open Terminal and type nano ~/.profile)

5.- add this line to the end of the file

export PATH=/Applications/MAMP/bin/php/php5.x.x/bin/:$PATH

The x of php is the version number, in my case i'm using 5.6.38 so I added

export PATH=/Applications/MAMP/bin/php/php5.6.38/bin/:$PATH

6.- restart computer

7.- now, if you type in terminal php -i | grep 'php.ini' you should get something like this

Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.6.28/conf
Loaded Configuration File => /Applications/MAMP/bin/php/php5.6.28/conf/php.ini

Now when you try to import it should work.

  • hey, facing the issue on Ubuntu now, can you help me on what should be the export path? – Sufyan Khot Mar 5 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.