开发者

How to generate unique alphanumeric content in MySQL?

开发者 https://www.devze.com 2022-12-22 02:24 出处:网络
Say, va开发者_运维技巧lues would be 1000-characters long.Are you sure you don\'t just want to use UUIDs?They\'re only 32 chars long, but there are near infinite combinations.You could use a 64-bit int

Say, va开发者_运维技巧lues would be 1000-characters long.


Are you sure you don't just want to use UUIDs? They're only 32 chars long, but there are near infinite combinations.


You could use a 64-bit integer field as backing and then convert to base 36, putting as many leading 0's as are needed in order to pad to your target number of characters (1,000 in this case).


concat(md5(rand()), md5(rand()), ...) should do the trick without much fuss.

0

精彩评论

暂无评论...
验证码 换一张
取 消