<p>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.</p>

<pre><code>sudo ln -s /Applications/MAMP/Library/bin/mysqldump /usr/local/bin/mysqldump
</code></pre>

<p><a href="https://github.com/craftcms/cms/issues/2364" rel="nofollow noreferrer">Here's a github issue</a> on the matter that runs through a few possible solutions (including the one above).</p>

CC BY-SA 4.0
2019-09-20T23:54:01.410Z
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
CC BY-SA 4.0
2019-09-20T21:14:32.223Z
2019-09-20T21:14:32.223Z
Evan Warner
<p>I have followed the instructions for this article (<a href="https://craftcms.com/guides/database-backups-in-craft-3-with-mamp" rel="nofollow noreferrer">https://craftcms.com/guides/database-backups-in-craft-3-with-mamp</a>) to get local backups working with MAMP. However, when I attempt a backup, I get this error: <code>exit code 127: sh: mysqldump: command not found</code>.</p>

<p><code>which mysqldump</code> returns <code>/Applications/MAMP/Library/bin/mysqldump</code> 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.</p>

<p>Is there something else I should be doing?</p>

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

<p><strong>UPDATE:</strong></p>

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

<pre><code>'backupCommand' =&gt; getenv('BACKUP_COMMAND'),
'restoreCommand' =&gt; getenv('RESTORE_COMMAND'),
</code></pre>

<p>...to my <code>general.php</code>.</p>

<p>So I tried adding <a href="https://gist.github.com/samhernandez/7f343c99a524cdd492dd864bc2d84179" rel="nofollow noreferrer">this module</a> instead and now DB backups work as expected.</p>

<p>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.</p>

<database><mysql><mamp><back-up>
Can't backup DB locally with MAMP PRO 5.5.1
# Can't backup DB locally with MAMP PRO 5.5.1

(Asked by: username_0 on 2019-09-20)

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.

**Tags:** database, mysql, mamp, back-up

---

## 1 answers

### Answer by username_1 on 2019-09-20. Score: 2

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).

> **Comments:**
> **username_0**: 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.  

---

