<p>Craft 3 did away with the PHP-based database backup solution that Craft 2 utilized (for many reasons).</p>

<p>Now it requires that the <a href="https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html" rel="noreferrer"><code>mysqldump</code></a> executable (if you're using MySQL) or <a href="https://www.postgresql.org/docs/9.3/static/app-pgdump.html" rel="noreferrer"><code>pg_dump</code></a> executable (if you're using PostgreSQL) is available to PHP in order to do backups.  This is usually just a matter of including the path to that executing in your PATH environment variable.</p>

<p>There is also the <a href="https://github.com/craftcms/cms/blob/develop/src/config/GeneralConfig.php#L111" rel="noreferrer"><code>backupCommand</code></a> config setting that you can use to override Craft's default backup implementation if you have some other backup solution you'd like to use.</p>

<p>Same for <a href="https://github.com/craftcms/cms/blob/develop/src/config/GeneralConfig.php#L553" rel="noreferrer"><code>restoreCommand</code></a>.</p>

<p>Related issue here: <a href="https://github.com/craftcms/cms/issues/1369" rel="noreferrer">https://github.com/craftcms/cms/issues/1369</a></p>

CC BY-SA 4.0
2019-01-16T17:29:10.683Z
I have exactly this issue; mariadb on OSX via homebrew; path added to .bash_profile, doesn't work.
Matt Wilcox
CC BY-SA 3.0
2018-04-04T04:28:52.503Z
Hi @brad, I used mariadb (via homebrew) and added the path to .bash_profile and it still wouldn't work. Neither works (export PATH=$PATH:/usr/local/Cellar/mariadb/10.2.13/bin or
export PATH=/usr/local/Cellar/mariadb/10.2.13/bin:$PATH). Do you have any ideas?
Anya Dit
CC BY-SA 3.0
2017-12-24T16:42:37.143Z
2017-12-24T17:06:02.073Z
2017-12-24T17:06:02.073Z
Brad Bell
<p>I just tried to export the DB on the Database Backup page. Unfortunately, I got an error message saying <strong>"There was a problem backing up your database. Please check the Craft logs."</strong></p>

<p>So I checked the logs, and found this...</p>

<blockquote>
  <p>Could not create backup: The shell command "mysqldump --defaults-extra-file=/mysite/storage/runtime/temp/my.cnf... failed with exit code 127: sh: mysqldump: command not found...</p>
</blockquote>

<p>(There's more to that error message, but I'm hoping that all the relevant parts are included here.)</p>

<p><strong>What am I missing?</strong> It seems like I still need to install something else, is that correct?</p>

<database>
Craft 3: Can't backup database ("mysqldump: command not found")
# Craft 3: Can't backup database ("mysqldump: command not found")

(Asked by: username_0 on 2017-12-24)

I just tried to export the DB on the Database Backup page. Unfortunately, I got an error message saying **"There was a problem backing up your database. Please check the Craft logs."**

So I checked the logs, and found this...

> Could not create backup: The shell command "mysqldump --defaults-extra-file=/mysite/storage/runtime/temp/my.cnf... failed with exit code 127: sh: mysqldump: command not found...

(There's more to that error message, but I'm hoping that all the relevant parts are included here.)

**What am I missing?** It seems like I still need to install something else, is that correct?

**Tags:** database


---

## 1 answers

### Answer by username_1 on 2017-12-24. Score: 8 | Accepted answer

Craft 3 did away with the PHP-based database backup solution that Craft 2 utilized (for many reasons).

Now it requires that the [`mysqldump`](https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html) executable (if you're using MySQL) or [`pg_dump`](https://www.postgresql.org/docs/9.3/static/app-pgdump.html) executable (if you're using PostgreSQL) is available to PHP in order to do backups. This is usually just a matter of including the path to that executing in your PATH environment variable.

There is also the [`backupCommand`](https://github.com/craftcms/cms/blob/develop/src/config/GeneralConfig.php#L111) config setting that you can use to override Craft's default backup implementation if you have some other backup solution you'd like to use.

Same for [`restoreCommand`](https://github.com/craftcms/cms/blob/develop/src/config/GeneralConfig.php#L553).

Related issue here: <https://github.com/craftcms/cms/issues/1369>

> **Comments:**
> **username_3**: Hi @brad, I used mariadb (via homebrew) and added the path to .bash_profile and it still wouldn't work. Neither works (export PATH=$PATH:/usr/local/Cellar/mariadb/10.2.13/bin or export PATH=/usr/local/Cellar/mariadb/10.2.13/bin:$PATH). Do you have any ideas?  
> **username_2**: I have exactly this issue; mariadb on OSX via homebrew; path added to .bash_profile, doesn't work.  

---

