batuman
batuman

Reputation: 7314

Loading mysql file to rds database in AWS

I have database inside aws ec2 instance. I like to transfer that ec2 instance's database to rds database.

From Phpmyadmin, database.sql file is exported firstly.

I have that file database.sql copied to the instance's ~/ folder.

Then login to mysql as

 mysql -h database.cqqqzagkqjoe.ap-southeast-1.rds.amazonaws.com -P 3306 -u testdatabase -p

Then the database.sql file was imported as

mysql> mysql -u username -p database < database.sql

After that I got error as

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 'mysql -u username -p database < database.sql' at line 1

What is wrong with that message?

Upvotes: 1

Views: 94

Answers (1)

hjpotter92
hjpotter92

Reputation: 80655

Do not log into the MySQL server as client, execute the SQL file.

So, from the EC2 instance itself:

mysql -h database.cqqqzagkqjoe.ap-southeast-1.rds.amazonaws.com -u testdatabase -p < database.sql

Upvotes: 2

Related Questions