Earlier I set up a development WordPress site that mirrored a live WordPress installation. To do this I dumped the entire WordPress database using mysqldump and then imported it into a new database with mysql. Among other things that needed to be changed I needed to update any links that referenced the live site’s URL with the development site’s URL. Below I provide the command to make such an update to only a matching portion of a column in row located in a MySQL database.
Last night I was working on a project for a customer where the application was going to reference external images after the changes I made. One of the custom parts of the project included modifying the thousands of rows that currently existed in the MySQL database. I needed away to modify one of the columns in a MySQL database table by adding data to the front of that column in each row.