一般错误:'" mysqldump"'不被视为内部或外部命令

时间:2018-04-12 04:44:23

标签: php laravel backup spatie

我使用Laravel Spatie Backup,安装完成, 首先运行此$ 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

然后$ php工匠供应商:发布--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.

但是当我跑步时

php artisan backup:run

出现此错误

  

备份失败,原因是:转储过程因exitcode 1而失败:   一般错误:'" mysqldump"'不被视为实习生或   外部命令,可操作程序或批处理文件。

注意:我使用的是Laravel 5.6版 和Spatie v.5

5 个答案:

答案 0 :(得分:6)

在config / database.php文件中,编辑mysql数据库配置并添加:

  '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
            ],

答案 1 :(得分:3)

config/database.php文件中,编辑mysql数据库配置并添加:

'dump_command_path' =>' '

这是mysqldump在你的系统上的绝对路径。这条路径可能就是这个,或类似的东西:C:\xampp\mysql\bin

希望这可以帮助你!!

答案 2 :(得分:2)

我遇到了这个问题

请关注这个 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
            ], 
    ],

答案 3 :(得分:0)

在您的<style> :root { --primary: #009c68; } </style> 文件中,编辑Mysql数据库配置并添加:

config/database.php

mysqldump 在系统上的绝对路径是该路径,或者类似的路径:'dump' => [ 'dump_binary_path' => 'C:\xampp\mysql\bin', 'use_single_transaction', 'timeout' => 60 * 5, // 5 minute timeout ], xampp 安装位置

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

答案 4 :(得分:0)

通过将此行添加到您的配置/数据库文件以备份文件和数据库,它将解决您的问题。它将 100% 工作。

这是显示您进行更改的位置的图像。 enter image description here