I want to do
We will dump the database created in Amazon RDS to the local environment and export dropped sql data to mysql in the local environment. The local environment can be local as usual in the Mac or local as in the mamp.
Dump data of sql
First of all, I normally connect ssh to ec2. Hit the mysqldump command on the server and drop the mysql data to the server and take that file locally. When entering the server, tap the following command appropriately. the host name in -h, the user name in -u, the database name after -p, the full path of where you want to drop data after>
$ mysqldump -h xxxxxxxx.csxxxxxxxx.us-east-1.rds.amazonaws.com -u admin -p xxxx_db> /home/ec2-user/dump_db.sql
If you hit the above command, you will be prompted for a password so please enter it. If it succeeds, the data in the database will fall as an sql file. I am dropping it to the local of Mac by ftp software or something.
Export sql data to local db
Next, I will export the dropped sql data to a local database. Here we will export the data to the database of the local mamp environment. To enter the database of the mamp environment on Mac, you can not go into db by moving under the mamp environment, so move to the mamp environment as follows.
Once you are in the mamp environment, export the data using the mysql command. newdb is the name of the database. It is a premise that has created a database called newdb in advance. Your data export is now complete.
./mysql -u root -p newdb < /Users/xxxx/Desktop/dump_db.sql