How to restore a database and take backup of database through shell?
Postgresql
Using following command you can take backup of postgresql database.
# pg_dump -u -C -f backupfile.sql database_name
You can restore pgsql database using following command
# pg_restore -v -C -O -d database_name backupfile.sql.tar
Mysql
Using following command you can take backup of mysql database.
# mysqldump database_name > backup.sql
You can restore mysql database using following command
# mysql database_name < backup.sql

















Leave a Reply
You must be logged in to post a comment.