0

I'm using wp-cli tool for searching and replacing the site's url to a new url. I'm executing this command in command line in the directory of the wordpress installation:

C:\xampp\htdocs\somewebsite>wp search-replace 'somewebsite.com' 'new_website.com' 

the command does not issue any errors, and when i check the database with this sql:

SELECT * FROM wp_options WHERE option_value LIKE '%new_website.com%'

I get zero results.

I have the the username, password, db name, location set correctly in wp.config file.

EDIT

By any chance does this have to do with the sql file permissions?

EDIT Ok it wp-cli did not work for me but https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ did. Make sure you use the stable version as of this writing which is: v2.1.0 STABLE.

dave
  • 14,991
  • 26
  • 76
  • 110
  • what am i doing wrong? – dave Sep 19 '15 at 00:31
  • Ok it wp-cli did not work for me but https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ did. Make sure you use the stable version as of this writing which is: v2.1.0 STABLE. – dave Sep 19 '15 at 01:36
  • possible duplicate of [MySQL search and replace syntax error](http://stackoverflow.com/questions/32592208/mysql-search-and-replace-syntax-error) – galfaro Sep 19 '15 at 14:24
  • Was it a really big db? I am running into this with a dump file that is around 150 mb. – Jake Jul 25 '17 at 19:22

4 Answers4

11

I just had the same issue, and the problem was single quotes in the Windows command prompt - the following worked for me:

wp search-replace "somewebsite.com" "new_website.com"

avy
  • 644
  • 6
  • 16
0

Your syntax looks correct. Try adding --verbose to the end of your search-replace command and check the output. All wp-cli search-replace options can be found here: http://wp-cli.org/commands/search-replace/

Andy
  • 46
  • 4
  • k i tried adding --debug: wp search-replace 'somewebsite.com' 'new_website.com' --debug, and still same results. – dave Sep 19 '15 at 00:36
  • by any chance does this have to do with the sql file permissions? – dave Sep 19 '15 at 00:38
  • --verbose did not print anything, just goes back to new line in command prompt – dave Sep 19 '15 at 00:39
0

You need to check your wp-config.php thoroughly. For me I was loading wp-settings.php twice which is the reason why there was no output at all because there were errors behind the scenes. You need to set define('WP_DEBUG', true); to see the errors and you can start fixing your wp-config.php from there.

JohnnyQ
  • 4,839
  • 6
  • 47
  • 65
0

I ran into a similar problem a while ago. As it turned out, I did not have the current wp-cli version installed. I was typing correct syntax, but the command was not executing, and no errors were returned.

wp cli check-update

wp cli update

after I updated to version 1.0 I no longer had any problems.

Just a thought.

RobBenz
  • 589
  • 1
  • 7
  • 21