5

I'm trying to import my .sql dump from local machine to AWS RDS db instance using the command:

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqldump --host=localhost 
--user=root --password=admin e_learning_system | mysql 
--host=mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com 
--user=root --password=adminadmin e_learning_system

but it is throwing this error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com' (10060) mysqldump: Got errno 22 on write

How do I correct this?

1
  • 2
    Have you edited the security group for the RDS host to open the MySQL TCP port for your IP address?
    – Phil
    Commented May 20, 2012 at 13:51

5 Answers 5

6

In case there is anyone who is still looking for a solution like I was, I managed to get it done by setting the security group in my RDS instance. Just go to that security group, you will find the click in "Security and Network" section. After you are on that security group page, edit the inbound rule, change the source to 0.0.0.0/0 (meaning accept from all) temporarily, and then import your db dump. That should work. But keep in mind you might want to revert it back this setting on production.

1
  • Ah, that fixed it! But can you tell me why is it insecure? Someone meaning to misuse it will have to know the username and password anyway, right? Commented Dec 22, 2015 at 20:28
5

Yes, Amazon Beanstalk application and RDS security groups must be same for connecting application to database instance..

Right click on database instance and add a new security group using by beanstalk application..

1
  • 5
    Screen shots or source material might be helpful.
    – JSuar
    Commented Dec 13, 2012 at 18:29
0

error 2003 means no connection to mysql server. Check if you allowed the machine from where you connect to RDS in the RDS security group.

0

I prefer using MySQL workbench. It's much more easier & user friendly than the command line way.

It provides a simple GUI.

MySQL workbench or SQL Yog.

These are the steps that I did.

1) Install MySQL Workbench.

2) In AWS console, there must be a security group for your RDS instance. Add an inbound rule to that group for allowing connections from your machine. It's simple. Add your IP-address.

3) Open MySQL workbench, Add a new connection.

4) Give the connection a name you prefer.

5) Choose connection method- Standard TCP/IP

6) Enter your RDS endpoint in the field of Hostname (mydbinstance.cyz1k1vacvdd.us-east-1.rds.amazonaws.com).

7) Port:3306

8) Username: master username (the one which which you created during the creation of your RDS instance) (root)

9)Password: master password (admin admin)

10) Click Test Connection to check your connection.

11) If connection is successful, click OK.

12) Open the connection.

13) you will see your database 'e_learning_system' there.

14) Now you can export your mysqldump file to this database. Go to-> Server. Click Data Import.

15) You can check whether the data has been migrated by simply opening a blank SQL file & typing in basic SQL commands like use database, select * from table;

1
  • 1
    This doesn't answer the question. The problem is his db instance is not accepting incoming connections. Using the workbench will not solve that.
    – Joe M
    Commented May 21, 2016 at 7:54
0

I was getting the same error and I solved it by adding mysql.exe... to the firewall of the machine I was connecting to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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