Link to home
Start Free TrialLog in
Avatar of David
David

asked on

wordpress - mysql - update path in all posts

Hi,

We have moved a wordpress site from a temporary server to the new server.

The mysql database is littered with the path details for anything from images to posts with the following in long lines in the database

http://185.123.97.162/~username/mydomain.com/etc etc etc

Is there a command i can use to search for any reference for the above to change it to

http://mydomain.com/etc etc etc


Or is there another way to do this?

I have tried changing the permalink to default the back again but no joy there
Thanks
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David
David

ASKER

performing a search in all tables in the database in phpMyAdmin i get many results in many tables, please see attached image

User generated image
So i want any reference to http://185.123.97.162/~username/mydomain.com/ to be changed to just http://mydomain.com
Avatar of David

ASKER

for example one post in the MySQL is

css=".vc_custom_1470043286616{padding-bottom: 40px !important;background: #e7ebf0 url(http://185.123.97.162/~username/mydomain.com/ wp-content/uploads/2016/05/rion-Key-Drivers.jpg?id=970) !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}" el_class="related"][vc_column][vc_column_text disable_pattern="false" align="center"]
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David

ASKER

unfortunately the plugin copied over the path

I think we can do this by some kind of query on each table but advice on this would be appreciated
Avatar of David

ASKER

for example in the wp0m_posts table there are 2368 items int eh post_content"  that need to be found and replaced
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
addendum - the advantage of the above method is you don't need to know the structure / use of the tables. This reduces to a search and replace operation. Once the DB is restored paths throughout the DB should be changed.
Avatar of David

ASKER

That was a great tip and updated all the links!!

The problem i have now is the site has a few issues now with image sizes and the logo has reverted back to the template default. Do you know why this migth be?
If you search the old db for the logo image and then find the corresponding in the new - what is the difference?

If you just replaced the domain names and paths for the URL's it should not affect the image sizes.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial