MySQLDump Usage in AWS RDS

The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfers to another SQL server. Additionally, the mysqldump command can export data in CSV, other delimited text, or XML formats.

MySQLDump has so many parameters that help in taking backup of the database in different scenarios. You can take a backup of the AWS RDS by providing its end-point as a host-name as shown below.

mysqldump -h somename.endpoint.eu-east-2.rds.amazonaws.com -P 3306 -u myUserName -pmyPassword –hex-blob –triggers –routines –databases mydbName > DumpFile.sql

Go to the MySQL bin folder to find mysqldump.exe if you are logged into Windows. Usually, it will be C:\Program Files\MySQL\MySQL Server\Bin. You should utilize the terminal window if you are using a Mac. Because mysqldump.exe is necessary for the process, you must have a MySQL client installed on your computer.

Please note that you will see the Create Database and USE Database commands in the dump file that is created by the aforementioned command. This indicates that the dump file will create a database with the same name and use it to create database objects. So, if you want to restore it as a copy on the same server or in a separate instance, don’t execute it or restore it in the same instance.

Triggers, stored procedures, user-defined functions, and views are all handled in the command by the triggers and routines specification.

Happy learning..!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s