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
If mysqldump is not identified by the cmd prompt that means it cannot recognize where the mysqldump.exe is located. You need to add path of the directory where the exe is located in the PATH variable under environment variables. After doing that your command will start working in the cmd prompt.
To dump/export a MySQL database, execute the following command in the Windows command prompt: mysqldump -u username -p dbname > filename. sql . After entering that command you will be prompted for your password.
It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.
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
],
],
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
],
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With