How to create a Backup

Hi,

i tried to make a Database backup with: (Backups :: Corteza Docs)

I am in the Folder with the .env and docker-compose.yaml files and the data folder.

docker-compose logs db | grep "GENERATED ROOT PASSWORD"
docker-compose exec -T \
    --env MYSQL_PWD=THEPASSWORD db \
    mysqldump dbname --add-drop-database -u dbuser > dump.sql

Sadly i only get:

mysqldump: Got error: 1045: Access denied for user ‘dbuser’@‘localhost’ (using password: YES) when trying to connect

I only skipped this step in the installationguide:
https://docs.cortezaproject.org/corteza-docs/2021.3/devops-guide/index.html#_setup_your_file_structure:

Make sure to change the owner to the Docker container (you can use chown 1001:1001 data/db and chown 4242:4242 data/server ). Omit if you won’t use persistent storage.

I didnt knew how to make this in the Terminal on a Mac. If i type chown 1001:1001 data/db, i get:
chown: data/db: Operation not permitted

Any great coder could give me a hint? Thank you very much!

2nd Question: I uploaded a Picture in to a Product. But its not in the Folder data/server. Where are the files stored? I thought i need to make a backup of this folder, because its stored there. Maybe i am on the wrong place?

You should use the MYSQL_PASSWORD instead of the root password here; so if we look at this, the password should be dbpass

Use sudo ...the command... here.

Is the picture available when you view the product? If not, you’ll also need to run the chown command for the data/server directory (same as with the db).

1 Like

Thank you tjerman! You helped a lot!

It is dumping the database now. Is it ok to use the --no-tablespaces option (to get rid of mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces)?

The chown was working. Thank you! But somehow both folders stay empty. I am uploading pdfs into a new contract or i am uploading pictures to a new product. They are shown in the browser in the contract or the product. But the Folders in the Finder stay empty.