# Command Guide To Backing Up Bookstack

This is done for this bookstack here.

Changing to the projects directory /var/www/bookstack

```bash
cd /var/www/bookstack
```

Use **mysqldump**  
**-u** is for user  
**-p** is for password   
***\*the bookstack following the -p in the code is the name of the database and not the password. You will enter the password.\****  
This will make you enter a password for the mysql root user in order to backup the database.  
**\***Change the date, I will update this code to use the current time instead of manually putting it in.

```bash
sudo mysqldump -u root -p bookstack | sudo tee bookstack.backup_3_28_24.sql > /dev/null
```

Copying that backup file to the network share example:

```bash
sudo cp -r bookstack.backup_3_28_24.sql /mnt/localcloud/BookStack_Backups/
```

Backup the Storage / Uploads / Themes / Public

```bash
sudo tar -czvf bookstack-files-backup_3_28_24.tar.gz .env public/uploads storage/uploads themes
```

Copy that to the network share:

```bash
cp bookstack-files-backup_3_28_24.tar.gz /mnt/localcloud/BookStack_Backups/
```

The backup is now on the network share...