Spatie package not working

Published 2 years ago by Khudadad

I'm using spatie package for backing up of my database in Laravel 5.2 but it is not working

When I run bellow artisan command:

php artisan backup:run

I get this error:

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

How to solve it?

Best Answer (As Selected By Khudadad)
willvincent

Did you follow all of the setup instructions?

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:\wamp\bin\mysql\mysql5.1.40\bin

bobbybouwmann

@Khudadad Well the error seems to be pretty clear right? Did you try to Google the error?

Make sure the user that is running the application is also able to run the command.

Khudadad

Thanks for the reply @bobbybouwmann , I googled but couldn't find an answer, it's my first time using Spatie package maybe I'm missing something in configuration of this package, could you guide me about configuring this package. I'm running this application on localhost.(wampserver) I don't know how to specify the path.

bobbybouwmann

You need to specify the path to the mysqldump command. If you install mysql correctly the path should be set automatically. I'm running a mac with vagrant and have no expirience with wampserver

Khudadad

@bobbybouwmann When I run backup:run command my database file (ie, accounting.sql) is created in storage->laravel-backup->temp but 0kb

willvincent

Did you follow all of the setup instructions?

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:\wamp\bin\mysql\mysql5.1.40\bin

Khudadad

@willvincent one more thing how about production server, I mean will differ 'dump_command_path' ? and how to set it?

'dump_command_path' => 'C:\wamp\bin\mysql\mysql5.6.17\bin'
willvincent

@Khudadad probably your best bet would be to set this value the same way other values are set in .env

Basically, just add a value to the .env file both on your local machine for dev, and the production server.. then instead of hardcoding the path in the config file, tell it to use the env value.

Or, just set it to env('DB_DUMP_COMMAND_PATH', 'C:\wamp\bin\mysql\mysql5.6.17\bin') in your config file, and ensure that variable is set properly in the .env on production.

Please sign in or create an account to participate in this conversation.