Portal Home > Knowledgebase > Articles Database > Find and Replace in MySQl database with PHPMyAdmin?


Find and Replace in MySQl database with PHPMyAdmin?




Posted by [Axelsson], 02-29-2008, 06:57 PM
I have a database filled with different URLs. Like this: http://www.sponsor.com/product345/ http://www.sponsor.com/product123/ http://www.sponsor.com/product647/ http://www.sponsor.com/product765/ I would like to replace http://www.sponsor.com/ with http://www.mydomain.com/ But let the product-pages be left untouched so the new URLs will look like: http://www.mydomain.com/product345/ http://www.mydomain.com/product123/ http://www.mydomain.com/product647/ http://www.mydomain.com/product765/ Does anyone know what the SQL-Query would look like?

Posted by case, 03-01-2008, 01:44 AM
Make sure you backup before trying... You can also use mysqldump to dump the table out to a SQL file, find and replace the string in a text editor, drop table, and pipe the SQL file back into mysql Last edited by case; 03-01-2008 at 01:59 AM.

Posted by case, 03-01-2008, 02:05 AM
Make sure you add a drop table which I forgot to add if you use the second method!

Posted by [Axelsson], 03-01-2008, 07:39 AM
Thanks case!



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Rotate Log Question (Views: 691)
lightspeed webserver (Views: 664)