# Backing up data on shared hosting accounts

> Create manual and automatic backups of your website files, databases and email on a shared hosting account.

Source: https://helpcenter.ruachost.com/cpanel/files/backing-up-data-on-shared-hosting-and-reseller-accounts-in-ruachost/

Regular backups are essential to protect your website files, databases, and emails. While Ruachost maintains server-level backups for disaster recovery, it is your responsibility to create and manage your own backups for maximum security and control.

This article explains how to back up your data manually and automatically on shared hosting accounts.

> **Important Notes:**
- Ruachost provides JetBackup 5 (automatic server backups) for shared hosting accounts, but you should still maintain your own backups.
- Backups should be stored **offsite** (e.g., your local computer, cloud storage) for best protection.

## Website File Backups

### Manual Backups

1. Log in to your account using **SSH** or **cPanel File Manager**.
2. To back up your public_html directory via SSH, run:

   ```bash
   /bin/tar -czvf /home/username/public_html.tar.gz /home/username/public_html
   ```

   Replace username with your Ruachost account username.
3. This creates a compressed file (public_html.tar.gz) containing all your website files.
4. Download the file to your local computer for safekeeping.

### Automatic Backups with Cron

You can schedule backups using **cron jobs**:

1. Log in to **cPanel**.
2. Go to **Advanced → Cron Jobs**.
3. Set the backup interval (daily, weekly, monthly).
4. Use the same tar command from above in the cron job.
5. Optionally, configure the job to copy the backup to a remote location (e.g., Google Drive, Amazon S3, or another server via SCP/rsync).

## MySQL Database Backups

### Manual Backups

1. Log in to **cPanel**.
2. Go to **Databases → phpMyAdmin**.
3. Select the database you want to back up.
4. Click **Export** and save the `.sql` file to your computer.

### Automatic Backups

1. Use the mysqldump command in a cron job:

   ```
   ```

   ```bash
   mysqldump -u dbuser -p'dbpassword' dbname > /home/username/dbname.sql
   ```
2. Replace `dbuser`, `dbpassword`, and `dbname` with your actual database credentials.
3. Store the `.sql` file securely or transfer it offsite.

## Backups in cPanel

cPanel also provides built-in backup tools:

1. Log in to **cPanel**.
2. Go to **Files → Backup**.
3. Choose **Download a Home Directory Backup** or **Download a MySQL Database Backup**.
4. Save the files to your local computer.
