How you can take database backups on linux

Written by AlanV on September 20, 2008 – 11:27 am -

MySQL is most popular and common database used in linux, unix and all
cPanel, Plesk servers ,
PostgreSQL is also used but it is not as widely use as MySQL

A. MySQL database backup

mysqldump is used to take the backup of MySQL databases

# mysqldump database_name > backupfile.sql
This will generate the backup of MySQL databases in .sql file

To restore dumps you can use mysql command

# mysql database_name < backupfile.sql

B. PostgreSQLdatabase backup

It is easy method to take PostgreSQL database backup

# pg_dump databaseame > databasename.pgdump

Restore the database from the dump

# cat databasename.pgdump | psql databasename

If database is large then you can use gzip to redeuce size if backup file

# pg_dump databasename | gzip > databasename.dump.gz

Then restore the dunp into database

gunzip -c databasename.dump.gz | psql databasename


Tags: , , , , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting | No Comments »
RSS

  • Subscribe Me

  • Tag Cloud

  • Archives