Database backup is mandatory those who are use user data in their application.
If something happen to database, using dump we can restore the backup to the database.
MySql database:
To dump/export:
mysqldump --user {username} --password {password} {database} backup.sql
mysqldump is the command to dump/export the database to file.
To undump/import:
mysql --user {username} --password {password} {database}
This will extract backup.sql to the database
PostgreSQL database:
To dump/export:
pg_dump -h {host-name} -U {username} -p {database name} backup.sql
Explanation:
pg_dump is the command to dump the database. The above command dump all data in the database {database} to the backup.sql file.
To undump/import:
psql -h {host-name} -U {username} -p {database name} < backup.sql
Dump/Export postgreSQL database:
Same as mysql this command will import data from backup.sql to the database.