BLOG HOME -  UK WEB HOSTING -  PHP MYSQL HOSTING -  RESELLER HOSTING -  eUKhost FORUMS -  VPS HOSTING

How to restore a database and take backup of database through shell?

Postgresql

Using the following command, you can take a backup of your postgresql database.

# pg_dump -u -C -f backupfile.sql database_name

You can restore a pgsql database using the following command

# pg_restore -v -C -O -d database_name backupfile.sql.tar

Mysql

Using the following command you can take backup of a mysql database.

# mysqldump database_name > backup.sql

You can a restore mysql database using the following command

# mysql database_name

digg this


This post is compiled by eUKhost.com

1 Comment »

  1. Web Hosting Reviews said,

    January 2, 2007 @ 4:29 pm

    Following commands also useful to take backup and restore of simple (not contains large objects) postgresql database.
    pg_dump mydb > db.out
    To restore database
    psql -d database -f db.out

RSS feed for comments on this post · TrackBack URI

Leave a Comment

You must be logged in to post a comment.