0

I'm trying to migrate my Magento 1 data from a DB located in AWS, to a Magento 2 in a local dockerized enviroment.

When I run

bin/magento migrate:settings -a -r -vvv app/code/Mymodules/Migration/etc/opensource-to-opensource/1.9.3.10/config.xml

The connection is refused

[PDOException (2002)] SQLSTATE[HY000] [2002] Connection refused

I've already opened the 3306 port to my local adding a Inbound rule to the Security Group, like this:

MYSQL/Aurora | TPC | 3306 | MYIPADDRESS/32 | My description

Questions

  • I'm using the Magento's non-root MySQL credentials, so remote connection should allowed right?
  • What else could be blocking the connection?
  • Is it possible to connect Data Migration Tool to a remote DB using a SSH Tunnel?

Extra details

If I try to connect from my terminal this way, the connection is also refused:

mysql -hxx.xxx.xx.xx -p3306 -umyuser -pmypassword

Here's my config.xml details:

...
    <source>
        <database host="xx.xxx.xx.xx" port="3306" name="mydb" user="myuser" password="mypassword" />
    </source>
    <destination>
        <database host="127.0.0.1" name="magento" user="magento" password="magento" />
    </destination>
    <options>
        <crypt_key>mymagento1key</crypt_key>
    </options>
</config>
0

I'm using the Magento's non-root MySQL credentials, so remote connection should allowed right?

Yes remote connection should work if correctly opened on Amazon Web Services, I had to ensure the same thing on Azure.

Regarding your issue for running mysql -u, you have the incorrect switch for Port. You need to confirm if you are able to access the database server remotely first before attempting to migrate.

It is supposed to be -P, -p is only for password.

mysql -u username -p -h hostname -P 3306

(I have done a recent remote data migration from Azure hosted Database Magento 1.7 to Magento 2.3.5 (local) by firstly confirming the remote host and ports)

| improve this answer | |
  • Same result. Removing the Port parameter o using -P as uppercase. 3306 should be the default port. – araujophillips May 27 at 12:46
  • In your question you specified port 3006: mysql -hxx.xxx.xx.xx -p3006 -umyuser -pmypassword Is this correct (as in AWS configured it from 3306 to 3006?) – CvRChameleon May 27 at 12:50
  • The right port is 3306, sorry. – araujophillips May 27 at 13:09
  • I do not see any way to connect using the data-migration-tool via ssh as you were asking originally. It is possible that somewhere in the AWS configuration the database port is not 'opened' to the outside if you aren't able to access it via mysql -u. In Azure you specifically have to configure it through the firewall. – CvRChameleon May 27 at 13:18
0

For some reason, the Inbound Rule to open the port 3306 is not being taken into consideration.

The only solution which work for me was my /etc/mysql/mysql.conf.d/mysqld.cnf file and addding the ip address to bind-address = 127.0.0.1 line.

Then, I had to restart mysql: sudo systemctl restart mysql.service

Now I'm able to connect to the DB remotely from my IP.

| improve this answer | |

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.