Data Migration Tool [Connection refused] from AWS to Local dockerized enviroment
-
14-04-2021 - |
题
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>
解决方案 2
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.
其他提示
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)