welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

mysqldump: unknown variable 'column-statistics=0' #608

Closed rastitkac closed 3 years ago

rastitkac commented 4 years ago

Describe the bug When running a DB operation (both pull and push) I get the error:

▬▬ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    local | mysqldump --host=[secret] --user=rastitkac --result-file="[secret]/wp-content/local-backup-1596799964.sql" wordmove
mysqldump: unknown variable 'column-statistics=0'

Wordmove command wordmove pull -e dev -d or wordmove push -e dev -d

Expected behavior I would expect that the operation finishes with success.

movefile.yml

global:
  sql_adapter: wpcli

local:
  vhost: "<%= ENV['LOCAL_VHOST'] %>"
  wordpress_path: "<%= ENV['LOCAL_DOCROOT'] %>" # use an absolute path here

  database:
    name: "<%= ENV['LOCAL_DB_NAME'] %>"
    user: "<%= ENV['LOCAL_DB_USER'] %>"
    password: "<%= ENV['LOCAL_DB_PASS'] %>" # could be blank, so always use quotes around
    host: "<%= ENV['LOCAL_DB_HOST'] %>"

dev:
  vhost: "<%= ENV['DEV_VHOST'] %>"
  wordpress_path: "<%= ENV['DEV_DOCROOT'] %>" # use an absolute path here

  database:
    name: "<%= ENV['DEV_DB_NAME'] %>"
    user: "<%= ENV['DEV_DB_USER'] %>"
    password: "<%= ENV['DEV_DB_PASS'] %>"
    host: "<%= ENV['DEV_DB_HOST'] %>"

  exclude:
    - '.git*' # don't want to overwrite or expose git information (security)
    - 'node_modules' # don't need this anywhere else then on local machine
    - 'movefile.yml' # don't need this anywhere else then on local machine
    - '.env' # don't want to expose sensitive information
    - '*.sql*' # database is moved in separate process so we don't want to move sql
    - 'wp-config.php' # don't want to overwrite wp-config
    - 'backup_*' # don't want to move backups of plugins and themes

  ssh:
    host: "<%= ENV['DEV_SSH_HOST'] %>"
    user: "<%= ENV['DEV_SSH_USER'] %>"
    rsync_options: '--progress --no-perms --no-owner --no-group' # Additional rsync options, optional

ENV Variables are loaded correctly from .env file

Exception/trace


Traceback (most recent call last):
    15: from /usr/local/bin/wordmove:23:in `<main>'
    14: from /usr/local/bin/wordmove:23:in `load'
    13: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/exe/wordmove:6:in `<top (required)>'
    12: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
    11: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    10: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
     9: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
     8: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:91:in `pull'
     7: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:39:in `handle_options'
     6: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:39:in `each'
     5: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:40:in `block in handle_options'
     4: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:92:in `block in pull'
     3: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/ssh.rb:47:in `pull_db'
     2: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/ssh/wpcli_sql_adapter.rb:29:in `backup_local_db!'
     1: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/base.rb:181:in `save_local_db'
/Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/base.rb:95:in `run': Return code reports an error (Wordmove::ShellCommandError)

Environment (please complete the following information):

Doctor

▬▬ Using Movefile: ./movefile.yml ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ Validating movefile section: global ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

✅  success | Formal validation passed

▬▬ Validating movefile section: local ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

❌  error | [/vhost] '': not matched to pattern /^https?:\/\//.

▬▬ Validating movefile section: dev ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

❌  error | [/vhost] '': not matched to pattern /^https?:\/\//.

▬▬ Validating movefile section: prod ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

❌  error | [/vhost] '': not matched to pattern /^https?:\/\//.

▬▬ Using Movefile: ./movefile.yml ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ Checking local database commands and connection ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

✅  success | `mysql` command is in $PATH

✅  success | `mysqldump` command is in $PATH

✅  success | Successfully connected to the MySQL server

✅  success | Successfully connected to the database

▬▬ Checking local wp-cli installation ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

✅  success | wp-cli is correctly installed

✅  success | wp-cli is up to date

▬▬ Checking rsync ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

✅  success | rsync is installed at version 2.6.9

▬▬ Checking SSH client ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

✅  success | SSH command found
rastitkac commented 4 years ago

PS: Thank you for this awesome tool ❤️

alessandro-fazzi commented 4 years ago

Hello there!

Sorry for the bug in the doctor about the .env: it's known and tracked here in the issue tracker, but since I'm working on a humongous refactor branch I left behind a couple of bugfixes.

I read your issue (thanks for the thorough report) and I'm afraid this is not properly a Wordmove's bug. As we read in your own snippet

▬▬ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    local | mysqldump --host=[secret] --user=rastitkac --result-file="[secret]/wp-content/local-backup-1596799964.sql" wordmove
mysqldump: unknown variable 'column-statistics=0'

wordmove is invoking that command in your local environment and the command is just fine AFAIK. It's your mysqldump apparently having something to complain 😄

Lurking on the web, I think you could try to pass to mysqldump through the movefile.yml the flag --column-statistics=0 (ref). you find our docs about how to passing options here.

Let us know and good luck!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.