1

I have followed the instructions for this article (https://craftcms.com/guides/database-backups-in-craft-3-with-mamp) to get local backups working with MAMP. However, when I attempt a backup, I get this error: exit code 127: sh: mysqldump: command not found.

which mysqldump returns /Applications/MAMP/Library/bin/mysqldump and I can dump a db successfully from the terminal using 'mysqldump` but it does not work from the Craft CP for backing up a DB or when Craft tries to backup a DB when running an update.

Is there something else I should be doing?

The help article referred to above seems to make it pretty clear that this should work.

UPDATE:

After further testing, it seemed that those .env variables just did not seem to be getting used after I added...

'backupCommand' => getenv('BACKUP_COMMAND'),
'restoreCommand' => getenv('RESTORE_COMMAND'),

...to my general.php.

So I tried adding this module instead and now DB backups work as expected.

I'd still be curious to hear from anyone at Craft as to what could be missing in that first method they've laid out.

1

I have run the following on my computer in order to allow Mac OS's terminal to speak to MAMP's MySQL. I have not done the steps outlined in your linked article. Craft's built-in backup tool works fine for me so perhaps this will help you too.

sudo ln -s /Applications/MAMP/Library/bin/mysqldump /usr/local/bin/mysqldump

Here's a github issue on the matter that runs through a few possible solutions (including the one above).

  • Thanks but I already have that alias and have it in my PATH environment variable so I think there's something else going on. Just couldn't guess at what. – Mike Sep 20 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.