16

I use Laravel Spatie Backup, the installation is complete, first running this $ composer require spatie/laravel-backup

$ composer require spatie/laravel-backup

Using version ^5.6 for spatie/laravel-backup
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing spatie/temporary-directory (1.1.3): Downloading (100%)
  - Installing spatie/db-dumper (2.9.0): Downloading (100%)
  - Installing spatie/laravel-backup (5.6.0): Downloading (100%)
spatie/laravel-backup suggests installing guzzlehttp/guzzle (Allows notifications to be sent via Slack)
Writing lock file
Generating optimized autoload files

and then $ php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"

 $ php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"

Copied File [\vendor\spatie\laravel-backup\config\backup.php] To [\config\backup.php]
Copied Directory [\vendor\spatie\laravel-backup\resources\lang] To [\resources\lang\vendor\backup]
Publishing complete.

But when I run

php artisan backup:run

this error appear

Backup failed because: The dump process failed with exitcode 1 : General error : '"mysqldump"' is not recognized as an intern al or external command, operable program or batch file.

NOTE: I use Laravel version 5.6 and Spatie v.5

apokryfos
  • 38,771
  • 9
  • 70
  • 114
Nasser Ali Karimi
  • 4,462
  • 6
  • 34
  • 77
  • If you type `mysqldump` on your server, what is the output? Also what operating system (and version) are you operating on? – domdambrogia Apr 12 '18 at 04:51
  • In your `config/database.php` file, edit the mysql database config and add: `'dump_command_path' =>' '` // absolute path to where mysqldump lives on your system That path is probably this, or something very similar: `C:\xampp\mysql\bin` – Hiren Gohel Apr 12 '18 at 04:52

4 Answers4

20

In your config/database.php file, edit the mysql database config and add:

'dump' => [
   'dump_binary_path' => 'C:/xampp/mysql/bin/', // only the path, so without `mysqldump` or `pg_dump`
   'use_single_transaction',
   'timeout' => 60 * 5, // 5 minute timeout
],
Nasser Ali Karimi
  • 4,462
  • 6
  • 34
  • 77
9

I face this issue

please follow this https://spatie.be/docs/laravel-backup/v4/installation-and-setup#dumping-the-database

//config/database.php
'connections' => [
    'mysql' => [
        'driver'    => 'mysql'
        ...,
        'dump' => [
                'dump_binary_path' => 'D:/xampp/mysql/bin/', // only the path, so without `mysqldump` or `pg_dump`
                'use_single_transaction',
                'timeout' => 60 * 5, // 5 minute timeout
            ], 
    ],
Najathi
  • 2,529
  • 24
  • 23
8

In your config/database.php file, edit the mysql database config and add:

'dump_command_path' =>' '

Which is the absolute path to where mysqldump lives on your system That path is probably this, or something very similar: C:\xampp\mysql\bin

Dharman
  • 30,962
  • 25
  • 85
  • 135
Hiren Gohel
  • 4,942
  • 6
  • 29
  • 48
2

It'll fix your problem by adding this line to your config/database file for taking backup of files and database. It will work 100%.

Here is the Image to show where you have made changes. enter image description here

Kaleemullah
  • 446
  • 3
  • 8