How to import a MYSQL dump into Amazon RDS

I just logged into my EC2 through Putty on Windows, and I ended up in my RDS instance and in one database I created. Then I try to import a SQL dump from my machine with the following code, which leads to an error.

mysql> source C:\Users\guru\Downloads\latest.sql; ERROR: Unknown command '\U'. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'source C:\Users' at line 1 ERROR: Unknown command '\D'. ERROR: Unknown command '\l'. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'uru\Downloads\latest.sql' at line 1 

File exists on my windows machine. Please help me resolve this error.

+6
source share
2 answers

I found a very simple and user-friendly solution: I downloaded SQLyog https://www.webyog.com and downloaded my ssh data for my ec2 and my MYSQL log in detail. I accessed my database using this GUI tool, which has all the features to import and export data as easy as on localhost / phpmyadmin

+4
source

As stated in the description, you will probably be better off working with your EC2 → RDS instances. If you really want to work from your local machine, though:

Try the following on the command line. You can also use powershell, but you will need to wrap this statement in cmd /c "mysql etc..." because powershell handles the redirection a little differently.

mysql -u myUser --password = myPass -h rdsEndpoint myDB <C: \ Users \ guru \ Downloads \ latest.sql

This procedure will also be useful if you need an instance of Windows EC2.

Aside: retrieving data from RDS to your local computer can become expensive, especially as your database grows. If you just do it as a backup solution, you can watch snapshots or automatic backups. If you do this to replicate your RDS environment, you can also transfer your data directly from RDS to your EC2 instances, which is free if both instances are in the same zone availability .

+3
source

Source: https://habr.com/ru/post/952958/


All Articles