devilbox icon indicating copy to clipboard operation
devilbox copied to clipboard

[Howto]: Use mysqldump-secure in non default PHP containers when running more than one PHP version.

Open BWBama85 opened this issue 2 years ago • 1 comments

Have you already checked elsewhere?

What are you struggling with?

When using multiple PHP versions, mysqldump-secure does not work in the non default containers without editing /etc/mysqldump-secure.cnf

After manually editing mysqldump-secure.cnf, mysqldump-secure works but only backs up inside the container and does not back up to the host folder.

mysqldump-secure only works inside the default PHP container.

What have you tried already?

Editing mysqlsecure.cnf but still does not backup to host non container backup directory.

What is your goal?

To be able to use mysqldump-secure inside any php container and not just the default php container.

BWBama85 avatar May 05 '23 18:05 BWBama85

Hey, just took a look on my local setup. It seems to be missing in the docs, but according to this piece of code, you can set the variables

MYSQL_BACKUP_USER=user_to_use_for_backup
MYSQL_BACKUP_PASS=your_password_for_that_user
MYSQL_BACKUP_HOST=mysql

in the .env file in the devilbox directory. After that restart the containers and try again. Locally it worked for me, hope it works for you too. Might look into opening a PR for the docs later, but not sure if I will remember.

ALSO for the issue of them not showing in the host's folder, but only in the container. It seems this is missing from the multi-php's docker-composer.override.yml. I added it to my other php containers, and can verify that now the backups are showing in the host's folder too. It should be a part of volumes: key. - ${HOST_PATH_BACKUPDIR:-./backups}:/shared/backups:rw${MOUNT_OPTIONS}

Image for reference. image

userwiths avatar Jul 10 '23 13:07 userwiths