Best way to get a reasonably random key for MYSQL records

Posted by Steve N on Stack Overflow See other posts from Stack Overflow or by Steve N
Published on 2011-01-05T17:15:58Z Indexed on 2011/01/05 17:53 UTC
Read the original article Hit count: 221

Hi there,

I need to generate a reasonably random unique key for a table. It should be something like a GUID for MYSQL. I've tried UUID, but it looks like only the first few characters are actually random- the rest are the same every time I insert them.

Essentially, it is desirable for this key field to be very difficult to guess, even if you already have one known value in the column.

What is the best way to do this, and how should I set up the field data type to store the value efficiently?

Thank you, Steve

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql