Spatie Laravel Backup - sh: mysqldump: command not found

  • Author: Kyle Murphy
  • Posted: 17 Sept 2024 (updated on 7 Oct 2026)
A green terminal icon above the error message mysqldump command not found, with the Custom Code IT logo at the top.

The problem

One of the software projects I'm working on uses the fantastic Laravel-Backup packages from Spatie.

The application needs to run on-demand backups from the web interface. When I called Laravel's Artisan::call() method, I ran into this error:

sh: mysqldump: command not found

The solution

If you've confirmed that MySQL or MariaDB is installed and running, find the binary with:

which mysqldump

Then add the path to the binary with the following config change in your config/database.php file:

'mariadb' => [
  ...
  'dump' => [
    'dump_binary_path' => env("DUMP_BINARY_PATH"),
  ]
]

The DUMP_BINARY_PATH environment variable points to your mysqldump path. In my case, it was:

/opt/homebrew/opt/mariadb@10.11/bin

Just include the path to the binary, not the binary itself.

Success! You should now be able to run the command from your web interface.

Kyle Murphy

Linux Backups with Restic and S3

A walkthrough of fast, encrypted Linux backups to S3-compatible storage with Restic, using Linode Object Storage as the example.

  • linux
  • backups
  • restic
  • s3
  • tutorial

You made it this far, you should probably contact us.

Take a moment to celebrate, give that scrolling finger a break, then contact us because we'd love to hear from you.

0466 624 345

Tell us how we can help you.