4

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?

7

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

Now it requires that the mysqldump executable (if you're using MySQL) or pg_dump 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 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.

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

| improve this answer | |
  • 1
    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 Apr 4 '18 at 4:28
  • I have exactly this issue; mariadb on OSX via homebrew; path added to .bash_profile, doesn't work. – Matt Wilcox Jan 16 '19 at 17:29

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.