0

I want to generate a random id for each entry in mysql but I don't want to use auto increment for security reasons. How can I create default value for the id column that creates a unique random string of 8 characters to use as the id for each user?

Thanks

random_0620
  • 1,636
  • 5
  • 23
  • 44
  • This [answer](https://stackoverflow.com/a/16738409/5513005) might help you. – Yash Karanke Jun 11 '17 at 20:03
  • What is a "character"? Just letters and digits? All 256? Base64? Consider `LEFT(TO_BASE64(UNHEX(MD5(UUID()))), 8)` (64 diff chars; needs 5.6.1) or `LEFT(MD5(UUID()), 8)` (just hex) – Rick James Jun 27 '17 at 09:11

0 Answers0