I think I done something pretty stupid a long time ago with my CMS install - I decided I would speed things up by moving all (most) of the media (images, JS, Flash etc) to another server, and reference it from there, sort of like a CDN.
Anyway, now I have decided to revert those changes, and I have modified the main templates, stylesheets etc, but I have made a lot of references to this URL throughout the content of the site.
Now I am wondering, is it possible for me to export the database, search and replace this URL (I have now put the files in the root of the install, so I can just remove the root URL of the other server and it will leave a local path to the files - /files/images/etc) and then re import?
Search and replace in SQL
Re: Search and replace in SQL
Yes, can be done, even without exporting your database, as long as you can use phpMyAdmin or something like it to approach your database.
In phpMyAdmin you can enter SQL commands to replace strings.
But PLEASE: be sure to make a back up before you do this, to prevent further harm.
I've been changing a lot of table content for some project, using SQL commands. Google really was my friend.
In phpMyAdmin you can enter SQL commands to replace strings.
Code: Select all
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
I've been changing a lot of table content for some project, using SQL commands. Google really was my friend.
Re: Search and replace in SQL
Thanks. Ill look up the rest, I just wasnt sure because I have heard that to do it on some systems you have to use a special program, something to do with the way some systems record field length so that if its changed manually, it messes things up.frankmanl wrote:Yes, can be done, even without exporting your database, as long as you can use phpMyAdmin or something like it to approach your database.
In phpMyAdmin you can enter SQL commands to replace strings.But PLEASE: be sure to make a back up before you do this, to prevent further harm.Code: Select all
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
I've been changing a lot of table content for some project, using SQL commands. Google really was my friend.
thanks for the help. will report back here with details once I have done it.