Add Random Hashes With Mysql

NB: This is a really really old post. See a newer better one about inserting and updating with random string.

Adding a new column to a table which needs to contain a different random hash for each row?

Mysql can easily generate md5 strings and update all rows in the table for you

UPDATE thetable
SET thecolumn = MD5(RAND())
WHERE thecolumn IS NULL