Databases cannot be backed up as regular files because the database continuously writes to its files, so you are very likely to backup an incomplete or corrupt set of files. Therefore you need to use a special database backup program to create the backup. After the backup program has done its job you can then copy, move and archive the backup files just like any ordinary file.
Most web server control panels come with a database administration program. A popular option is phpMyAdmin for MySQL databases and phpPgAdmin for Postgres. Here are step by step backup instructions for some of the more popular control panels. And equally important: restore instructions.
The drawback with these database administration programs is that you have to perform the backup manually. If you’re like most people you will put off a manual chore like this until it’s too late. Therefore the goal should always be to automate your backups. If you’re running a WordPress blog on your web site you should definitely install the excellent WordPress Database Backup plugin. This plugin used to be distributed with WordPress 2.0 but was later mysteriously dropped from the standard distribution. If you have other programs on your web site that store information in a MySQL database then you need a full backup script like AutoMySQLBackup. Note that this latter solution requires some Linux shell knowledge to setup.
A great feature of both the WordPress Database Backup plugin and AutoMySQLBackup is the ability to email the backup files to yourself every day. I recommend that you setup a new Google Gmail account which has over 2 GB of storage to receive your backup files. Unless you’re a very prolific blogger, 2 GB should last you for quite a while. Then once a month or so you can login to the email account and delete old files.
Just like with regular backups is critical that you test your restore procedure occasionally. For this you can install MySQL or Postgres locally on your PC and restore the data to it. Backup files typically contain checksums and integrity checks, so if the file restores without errors then it’s very likely that the restore was successful without you having to verify the contents of all the data.
Now go back something up!