I just logged into my EC2 via Putty on Windows and I got into my RDS instance and into one database I had created. Then I try to import a SQL dump from my machine with the following code which results into 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
The file exists in my Windows machine. Please help me resolve the error.
Place the dump file in an Amazon S3 bucket. Download the dump file from the Amazon S3 bucket to the DATA_PUMP_DIR directory on the target RDS for Oracle DB instance. Import the data from the copied dump file into the RDS for Oracle DB instance using the package DBMS_DATAPUMP .
To import an SQL dump file: Connect to your MySQL database. Choose Import > From SQL Dump… from the File menu. This will bring up a dialog box, select the file on your file system that you would like to import, then click Import . Your database will now be updated.
To create a MySQL DB instance with Easy createIn the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to create the DB instance. In the navigation pane, choose Databases. Choose Create database and make sure that Easy create is chosen. In Configuration, choose MySQL.
As datasage mentioned, you would probably be better off working from your EC2 -> RDS instances. If you really want to work from your local machine, though:
Install MySQL for Windows: http://dev.mysql.com/downloads/mysql/
Add the parent directory of mysql.exe (the mysql command line tool) to your path environment variable.
Try the following in the command prompt. You could use powershell also, but you would need to wrap this statement in cmd /c "mysql etc..."
because powershell handles redirection a little differently.
mysql -u myUser --password=myPass -h rdsEndpoint myDB < C:\Users\guru\Downloads\latest.sql
This procedure would also be useful to know if you have need for a Windows EC2 instance.
As an aside: extracting data from RDS to your local machine can get pricey, especially as your database grows. If you're just doing this as a backup solution, then you may want to look into Snapshots or automated backups. If you are doing this to replicate your RDS environment you could also transfer your data directly from RDS to your EC2 instances, which is free if both instances are in the same availability zone.
I found a very simple and user friendly solution: Downloaded SQLyog https://www.webyog.com and fed in my ssh details for my ec2 and my MYSQL log in details. I ended up accessing a my database using this GUI tool that has all the options for importing and exporting data as easy as on localhost/phpmyadmin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With