首页 > 解决方案 > mysqldump:运行命令 php artisan schema:dump 时,laravel 中的未知变量“set-gtid-purged=OFF”

问题描述

我正在使用 Laravel:8.^0。经过几次迁移后,我尝试运行php artisan schema:dump以生成 sql 文件。但我收到以下错误

mysqldump: unknown variable 'column-statistics=0'
mysqldump: unknown variable 'set-gtid-purged=OFF'

   Symfony\Component\Process\Exception\ProcessFailedException 

  The command "mysqldump  --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --skip-add-locks --skip-comments --skip-set-charset --tz-utc --set-gtid-purged=OFF "${:LARAVEL_LOAD_DATABASE}" --routines --result-file="${:LARAVEL_LOAD_PATH}" --no-data" failed.

Exit Code: 7(Unknown error)

Working directory: D:\laravel

Output:
================


Error Output:
================
mysqldump: unknown variable 'set-gtid-purged=OFF'

  at D:\laravel\vendor\symfony\process\Process.php:257
    253▕      */
    254▕     public function mustRun(callable $callback = null, array $env = []): self   
    255▕     {
    256▕         if (0 !== $this->run($callback, $env)) {
  ➜ 257▕             throw new ProcessFailedException($this);
    258▕         }
    259▕
    260▕         return $this;
    261▕     }

  1   D:\laravel\vendor\laravel\framework\src\Illuminate\Database\Schema\MySqlSchemaState.php:142e\Schema\MySqlSchemaState.php:142
      Symfony\Component\Process\Process::mustRun(Object(Closure))
                                                                                         e\Schema\MySqlSchemaState.php:145
  2   D:\laravel\vendor\laravel\framework\src\Illuminate\Databasonent\Process\Process), Object(Closure))e\Schema\MySqlSchemaState.php:145
      Illuminate\Database\Schema\MySqlSchemaState::executeDumpProcess(Object(Symfony\Component\Process\Process), Object(Closure))

我正在使用低于 mysql 版本的 docker mysql 容器

mysql Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)

标签: mysqllaravellaravel-8

解决方案


推荐阅读