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 transfer to another server. The mysqldump command can also generate output in CSV, other delimited text, or XML format. Although it appears to be a little executable file, its scope is greater to accommodate a variety of use-cases.
mysqldump accepts various connection options, DDL Options, Format Options, Filtering Options, Performance Options, Transactional Options, etc.
This post will demonstrate how to use mysqldump to backup ALL databases at once.
mysqldump -h <HostName OR IP Address OR RDS End Point> -u <UserName> -p<Password>
–triggers –routines –all-databases –skip-lock-tables > dbsDump.sql
mysqldump -h 127.0.0.1 -u root -p –triggers –routines –all-databases –skip-lock-tables > DBsBackup.sql
mysqldump -h instance-live.uvxyzcynxmabbaz.eu-east-2.rds.amazonaws.com -u root -p –triggers –routines –all-databases –skip-lock-tables > DBsBackup.sql
The above commands help in backing up the views, triggers and routines as well. And the below command will help in restoring them.
mysql -h instance-test.uvxyzcynxmabbaz.eu-east-2.rds.amazonaws.com -u root -p < DBsBackup.sql