正在将 mysql 文件加载到 AWS 中的 rds 数据库

Loading mysql file to rds database in AWS

我里面有数据库 aws ec2 instance。我喜欢将那个 ec2 实例的数据库转移到 rds 数据库。

首先从 Phpmyadmin 导出 database.sql 文件。

我已将该文件 database.sql 复制到实例的 ~/ 文件夹中。

然后以

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

然后 database.sql 文件被导入为

mysql> mysql -u 用户名 -p 数据库 < database.sql

之后我得到了错误

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

该消息有什么问题?

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

因此,从 EC2 实例本身:

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