wp-cli / db-command

Performs basic database operations using credentials stored in wp-config.php.
MIT License
71 stars 59 forks source link

wp db cli hangs #173

Closed johnbillion closed 4 years ago

johnbillion commented 4 years ago

Bug Report

Describe the current, buggy behavior

Running the wp db cli command in order to open a mysql console results in the command hanging indefinitely until I abort with ctrl+c. The mysql console does not appear.

I'm unsure what the cause is, most likely it's a certain combination of environment and configuration. This may be related to #168 ?

Here's the output of `wp db cli --debug`. ``` Debug (bootstrap): Loading packages from: /Users/john/.wp-cli/packages/vendor/autoload.php (0.007s) Debug (bootstrap): Loading detected autoloader: /Users/john/.wp-cli/packages/vendor/autoload.php (0.008s) Debug (commands): Adding command: login (0.011s) Debug (bootstrap): Fallback autoloader paths: /Users/john/sites/wp-cli-dev/wp-cli/vendor/autoload.php (0.011s) Debug (bootstrap): Loading detected autoloader: /Users/john/sites/wp-cli-dev/wp-cli/vendor/autoload.php (0.011s) Debug (commands): Deferring command: scaffold package (0.012s) Debug (commands): Deferring command: scaffold package-readme (0.013s) Debug (commands): Deferring command: scaffold package-tests (0.013s) Debug (commands): Deferring command: scaffold package-github (0.013s) Debug (commands): Adding command: cache (0.014s) Debug (commands): Adding command: transient (0.016s) Debug (commands): Adding command: comment (0.019s) Debug (commands): Adding command: meta in comment Namespace (0.021s) Debug (commands): Adding command: menu (0.022s) Debug (commands): Adding command: item in menu Namespace (0.024s) Debug (commands): Adding command: location in menu Namespace (0.025s) Debug (commands): Deferring command: network meta (0.025s) Debug (commands): Adding command: option (0.028s) Debug (commands): Adding command: post (0.035s) Debug (commands): Adding command: meta in post Namespace (0.036s) Debug (commands): Adding command: term in post Namespace (0.037s) Debug (commands): Adding command: post-type (0.038s) Debug (commands): Adding command: site (0.041s) Debug (commands): Adding command: meta in site Namespace (0.042s) Debug (commands): Adding command: option in site Namespace (0.043s) Debug (commands): Adding command: taxonomy (0.044s) Debug (commands): Adding command: term (0.048s) Debug (commands): Adding command: meta in term Namespace (0.049s) Debug (commands): Adding command: user (0.054s) Debug (commands): Adding command: meta in user Namespace (0.056s) Debug (commands): Adding command: session in user Namespace (0.057s) Debug (commands): Adding command: term in user Namespace (0.058s) Debug (commands): Adding command: network (0.058s) Debug (hooks): Processing hook "after_add_command:network" with 1 callbacks (0.058s) Debug (hooks): On hook "after_add_command:network": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.058s) Debug (commands): Adding command: meta in network Namespace (0.059s) Debug (commands): Adding command: db (0.074s) Debug (commands): Adding command: plugin (0.084s) Debug (commands): Adding command: theme (0.088s) Debug (commands): Adding command: mod in theme Namespace (0.089s) Debug (commands): Adding command: scaffold (0.096s) Debug (hooks): Processing hook "after_add_command:scaffold" with 4 callbacks (0.096s) Debug (hooks): On hook "after_add_command:scaffold": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.096s) Debug (commands): Adding command: package in scaffold Namespace (0.097s) Debug (hooks): On hook "after_add_command:scaffold": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.097s) Debug (commands): Adding command: package-readme in scaffold Namespace (0.098s) Debug (hooks): On hook "after_add_command:scaffold": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.098s) Debug (commands): Adding command: package-tests in scaffold Namespace (0.1s) Debug (hooks): On hook "after_add_command:scaffold": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.1s) Debug (commands): Adding command: package-github in scaffold Namespace (0.101s) Debug (commands): Adding command: core (0.101s) Debug (commands): Adding command: verify-checksums in core Namespace (0.102s) Debug (commands): Adding command: verify-checksums in plugin Namespace (0.103s) Debug (commands): Adding command: export (0.105s) Debug (commands): Adding command: core (0.111s) Debug (commands): Adding command: config (0.115s) Debug (commands): Adding command: cron (0.116s) Debug (commands): Adding command: event in cron Namespace (0.118s) Debug (commands): Adding command: schedule in cron Namespace (0.119s) Debug (commands): Adding command: eval (0.119s) Debug (commands): Adding command: eval-file (0.119s) Debug (commands): Adding command: import (0.122s) Debug (commands): Deferring command: language core (0.123s) Debug (commands): Deferring command: language plugin (0.124s) Debug (commands): Deferring command: language theme (0.124s) Debug (hooks): Immediately invoking on passed hook "after_add_command:site": Closure in file /Users/john/sites/wp-cli-dev/language-command/language-command.php at line 39 (0.124s) Debug (commands): Adding command: switch-language in site Namespace (0.124s) Debug (commands): Adding command: language (0.124s) Debug (hooks): Processing hook "after_add_command:language" with 3 callbacks (0.124s) Debug (hooks): On hook "after_add_command:language": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.124s) Debug (commands): Adding command: core in language Namespace (0.125s) Debug (hooks): On hook "after_add_command:language": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.125s) Debug (commands): Adding command: plugin in language Namespace (0.126s) Debug (hooks): On hook "after_add_command:language": Closure in file /Users/john/sites/wp-cli-dev/wp-cli/php/class-wp-cli.php at line 634 (0.126s) Debug (commands): Adding command: theme in language Namespace (0.127s) Debug (commands): Adding command: media (0.132s) Debug (commands): Adding command: package (0.136s) Debug (commands): Adding command: embed (0.136s) Debug (commands): Adding command: fetch in embed Namespace (0.138s) Debug (commands): Adding command: provider in embed Namespace (0.139s) Debug (commands): Adding command: handler in embed Namespace (0.14s) Debug (commands): Adding command: cache in embed Namespace (0.141s) Debug (commands): Adding command: i18n (0.142s) Debug (commands): Adding command: make-pot in i18n Namespace (0.145s) Debug (commands): Adding command: make-json in i18n Namespace (0.146s) Debug (commands): Adding command: maintenance-mode (0.146s) Debug (commands): Adding command: rewrite (0.147s) Debug (commands): Adding command: rewrite (0.148s) Debug (commands): Adding command: cap (0.149s) Debug (commands): Adding command: role (0.15s) Debug (commands): Adding command: search-replace (0.154s) Debug (commands): Adding command: server (0.156s) Debug (commands): Adding command: shell (0.156s) Debug (commands): Adding command: super-admin (0.157s) Debug (commands): Adding command: widget (0.159s) Debug (commands): Adding command: sidebar (0.16s) Debug (commands): Adding command: admin (0.16s) Debug (commands): Adding command: dist-archive (0.161s) Debug (commands): Adding command: doctor (0.162s) Debug (commands): Adding command: find (0.163s) Debug (commandfactory): No doc comment for google-sitemap. (0.163s) Debug (commands): Adding command: google-sitemap (0.163s) Debug (commandfactory): No doc comment for profile. (0.165s) Debug (commands): Adding command: profile (0.167s) Debug (commands): Adding command: super-cache (0.168s) Debug (commands): Adding command: maintenance (0.168s) Debug (commands): Adding command: contrib-list in maintenance Namespace (0.169s) Debug (commands): Adding command: milestones-after in maintenance Namespace (0.169s) Debug (commands): Adding command: milestones-since in maintenance Namespace (0.169s) Debug (commands): Adding command: release-date in maintenance Namespace (0.169s) Debug (commands): Adding command: release-notes in maintenance Namespace (0.17s) Debug (commands): Adding command: replace-label in maintenance Namespace (0.17s) Debug (bootstrap): Adding framework command: /Users/john/sites/wp-cli-dev/wp-cli/php/commands/cli.php (0.17s) Debug (commands): Adding command: cli (0.175s) Debug (commands): Adding command: cache in cli Namespace (0.175s) Debug (commands): Adding command: alias in cli Namespace (0.176s) Debug (bootstrap): Adding framework command: /Users/john/sites/wp-cli-dev/wp-cli/php/commands/help.php (0.176s) Debug (commands): Adding command: help (0.176s) Debug (bootstrap): Using default global config: /Users/john/.wp-cli/config.yml (0.177s) Debug (bootstrap): Using project config: /Users/john/sites/wp/wp-cli.local.yml (0.177s) Debug (bootstrap): argv: /Users/john/sites/wp-cli-dev/wp-cli/bin/../php/boot-fs.php db cli --debug (0.177s) Debug (bootstrap): ABSPATH defined: /Users/john/sites/wp/src/ (0.177s) Debug (bootstrap): Set URL: https://wp.test (0.177s) Debug (bootstrap): Begin WordPress load (0.177s) Debug (bootstrap): wp-config.php path: /Users/john/sites/wp/wp-config.php (0.177s) Debug (hooks): Processing hook "before_run_command" with 1 callbacks (0.177s) Debug (hooks): On hook "before_run_command": WP_CLI\Bootstrap\RegisterDeferredCommands->add_deferred_commands() (0.177s) Debug (bootstrap): Running command: db cli (0.177s) Debug (db): Running shell command: /usr/bin/env mysql --no-defaults --no-auto-rehash (0.182s) Debug (db): Associative arguments: {"database":"wp"} (0.182s) ```

Let us know what environment you are running this on

> wp cli info
OS:   Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Shell:  /bin/zsh
PHP binary:     /usr/bin/php
PHP version:    7.3.11
php.ini used:
MySQL binary:   /usr/local/bin/mysql
MySQL version:  mysql  Ver 15.1 Distrib 10.4.13-MariaDB, for osx10.15 (x86_64) using readline 5.1
SQL modes:      STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir:        /Users/john/sites/wp-cli-dev/wp-cli
WP-CLI vendor dir:      /Users/john/sites/wp-cli-dev/wp-cli/vendor
WP_CLI phar path:
WP-CLI packages dir:    /Users/john/.wp-cli/packages/
WP-CLI global config:   /Users/john/.wp-cli/config.yml
WP-CLI project config:  /Users/john/sites/wp/wp-cli.local.yml
WP-CLI version: 2.5.0-alpha