0

I'm getting a new Vagrant VM WordPress setup. I've downloaded my production db and I normally I go through and use a search and replace to find a production url and change that to a local development URL. This has worked great in the past, but I'm getting an ERROR:Error reconnecting to the database. It will work if I don't use the --network flag, but then I'm missing changes on the database.

Here's the command and the error. I'm going to post the debug so that that it's all here, please let me know if I should put that in gist or external file/link.

Any thoughts on this Error, seems like it times out. I can confirm mySQL is running. I'm using Sequel Pro and Terminal. Ubuntu 16.04 Apache/2.4.43 (Ubuntu)

I've read about changing the wp-config from localhost to 127.0.0.1, and also tried port added those didn't work.

wp search-replace 'domain-affiliate.com' 'domain-affiliate.dvlp' --network --dry-run --debug
Error: Error reconnecting to the database. This means that we lost contact with the database server at `127.0.0.1`. This could mean your host’s database server is down.


wp --info
OS: Linux 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64
Shell:  /bin/bash
PHP binary: /usr/bin/php7.4
PHP version:    7.4.8
php.ini used:   /etc/php/7.4/cli/php.ini
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /var/www/html/scasurgery-network/public_html
WP-CLI packages dir:    
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.4.0

--debug output

Errors and debug trying to use WP-CLI to find and replace.

vagrant@ubuntu1604:/var/www/html/domain-network/public_html$ wp search-replace 'domain-affiliate.com' 'domain-affiliate.dvlp' --network --dry-run --debug
Debug (bootstrap): Fallback autoloader paths: phar://wp-cli.phar/vendor/autoload.php (0.008s)
Debug (bootstrap): Loading detected autoloader: phar://wp-cli.phar/vendor/autoload.php (0.009s)
Debug (commands): Adding command: cache (0.011s)
Debug (commands): Adding command: transient (0.012s)
Debug (commands): Adding command: comment (0.013s)
Debug (commands): Adding command: meta in comment Namespace (0.014s)
Debug (commands): Adding command: menu (0.014s)
Debug (commands): Adding command: item in menu Namespace (0.015s)
Debug (commands): Adding command: location in menu Namespace (0.015s)
Debug (commands): Deferring command: network meta (0.015s)
Debug (commands): Adding command: option (0.016s)
Debug (commands): Adding command: post (0.018s)
Debug (commands): Adding command: meta in post Namespace (0.018s)
Debug (commands): Adding command: term in post Namespace (0.019s)
Debug (commands): Adding command: post-type (0.019s)
Debug (commands): Adding command: site (0.02s)
Debug (commands): Adding command: meta in site Namespace (0.02s)
Debug (commands): Adding command: option in site Namespace (0.021s)
Debug (commands): Adding command: taxonomy (0.021s)
Debug (commands): Adding command: term (0.022s)
Debug (commands): Adding command: meta in term Namespace (0.023s)
Debug (commands): Adding command: user (0.024s)
Debug (commands): Adding command: meta in user Namespace (0.025s)
Debug (commands): Adding command: session in user Namespace (0.025s)
Debug (commands): Adding command: term in user Namespace (0.026s)
Debug (commands): Adding command: network (0.026s)
Debug (hooks): Processing hook "after_add_command:network" with 1 callbacks (0.026s)
Debug (hooks): On hook "after_add_command:network": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.026s)
Debug (commands): Adding command: meta in network Namespace (0.027s)
Debug (commands): Adding command: db (0.029s)
Debug (commands): Adding command: plugin (0.031s)
Debug (commands): Adding command: theme (0.032s)
Debug (commands): Adding command: mod in theme Namespace (0.033s)
Debug (commands): Adding command: scaffold (0.034s)
Debug (commands): Adding command: core (0.034s)
Debug (commands): Adding command: verify-checksums in core Namespace (0.035s)
Debug (commands): Adding command: verify-checksums in plugin Namespace (0.035s)
Debug (commands): Adding command: export (0.036s)
Debug (commands): Adding command: config (0.037s)
Debug (commands): Adding command: core (0.038s)
Debug (commands): Adding command: eval (0.039s)
Debug (commands): Adding command: eval-file (0.039s)
Debug (commands): Adding command: import (0.039s)
Debug (commands): Adding command: media (0.04s)
Debug (commands): Adding command: package (0.041s)
Debug (commands): Adding command: cron (0.042s)
Debug (commands): Adding command: event in cron Namespace (0.042s)
Debug (commands): Adding command: schedule in cron Namespace (0.042s)
Debug (commands): Adding command: embed (0.042s)
Debug (commands): Adding command: fetch in embed Namespace (0.043s)
Debug (commands): Adding command: provider in embed Namespace (0.043s)
Debug (commands): Adding command: handler in embed Namespace (0.043s)
Debug (commands): Adding command: cache in embed Namespace (0.044s)
Debug (commands): Adding command: i18n (0.044s)
Debug (commands): Adding command: make-pot in i18n Namespace (0.045s)
Debug (commands): Adding command: make-json in i18n Namespace (0.045s)
Debug (commands): Deferring command: language core (0.046s)
Debug (commands): Deferring command: language plugin (0.047s)
Debug (commands): Deferring command: language theme (0.047s)
Debug (hooks): Immediately invoking on passed hook "after_add_command:site": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/language-command/language-command.php at line 39 (0.047s)
Debug (commands): Adding command: switch-language in site Namespace (0.048s)
Debug (commands): Adding command: language (0.048s)
Debug (hooks): Processing hook "after_add_command:language" with 3 callbacks (0.048s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.049s)
Debug (commands): Adding command: core in language Namespace (0.049s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.049s)
Debug (commands): Adding command: plugin in language Namespace (0.05s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.05s)
Debug (commands): Adding command: theme in language Namespace (0.05s)
Debug (commands): Adding command: maintenance-mode (0.051s)
Debug (commands): Adding command: rewrite (0.052s)
Debug (commands): Adding command: rewrite (0.052s)
Debug (commands): Adding command: cap (0.052s)
Debug (commands): Adding command: role (0.053s)
Debug (commands): Adding command: search-replace (0.054s)
Debug (commands): Adding command: server (0.055s)
Debug (commands): Adding command: shell (0.055s)
Debug (commands): Adding command: super-admin (0.055s)
Debug (commands): Adding command: widget (0.056s)
Debug (commands): Adding command: sidebar (0.056s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/cli.php (0.057s)
Debug (commands): Adding command: cli (0.058s)
Debug (commands): Adding command: cache in cli Namespace (0.058s)
Debug (commands): Adding command: alias in cli Namespace (0.058s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/help.php (0.059s)
Debug (commands): Adding command: help (0.059s)
Debug (bootstrap): No readable global config found (0.059s)
Debug (bootstrap): No project config found (0.06s)
Debug (bootstrap): argv: /usr/local/bin/wp search-replace domain-affiliate.com domain-affiliate.dvlp --network --dry-run --debug (0.06s)
Debug (bootstrap): ABSPATH defined: /var/www/html/domain-network/public_html/ (0.06s)
Debug (bootstrap): Begin WordPress load (0.061s)
Debug (bootstrap): wp-config.php path: /var/www/html/domain-network/public_html/wp-config.php (0.062s)
Debug (bootstrap): Set URL: domain-network.dvlp (0.072s)
PHP Notice:  compact(): Undefined variable: groupby in /var/www/html/domain-network/public_html/wp-includes/class-wp-site-query.php on line 544
Notice: compact(): Undefined variable: groupby in /var/www/html/domain-network/public_html/wp-includes/class-wp-site-query.php on line 544
Debug (commands): Adding command: yoast (0.306s)
Debug (commands): Adding command: redirect in yoast Namespace (0.306s)
PHP Notice:  Trying to access array offset on value of type bool in /var/www/html/domain-network/public_html/wp-includes/theme.php on line 2242
Notice: Trying to access array offset on value of type bool in /var/www/html/domain-network/public_html/wp-includes/theme.php on line 2242
Debug (bootstrap): Loaded WordPress (0.369s)
Debug (hooks): Processing hook "before_run_command" with 1 callbacks (0.369s)
Debug (hooks): On hook "before_run_command": WP_CLI\Bootstrap\RegisterDeferredCommands->add_deferred_commands() (0.37s)
Debug (bootstrap): Running command: search-replace (0.37s)
Error: Error reconnecting to the database. This means that we lost contact with the database server at `localhost`. This could mean your host’s database server is down.
vagrant@ubuntu1604:/var/www/html/domain-network/public_html$ 
  • Can you confirm the database is up during the command? Where is your vagrant setup sourced from? Have you contacted their support route? – Tom J Nowell Jul 23 at 19:42
  • I guess I can't confirm but I did check by running status before and after. I just updated my WP, the reason I'm moving everything. Now I just get Error: Error establishing a database connection. I sourced the Ubuntu box with VMWare Fusion. I have another laptop, same box, different 7.2 and wp cli is 2.3.0 where the newer one that's giving my trouble is 7.4.8 and 2.4.0 – kaplan Jul 23 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.