Created
December 24, 2022 23:49
-
-
Save acosonic/d509e0df4705595c464e8dd62fbeb190 to your computer and use it in GitHub Desktop.
Truly random MySQL uuid (taken from https://stackoverflow.com/a/60091504/800965)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE mytable SET uuid=(LOWER(CONCAT( | |
LPAD(HEX(ROUND(rand()*POW(2,32))), 8, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,16))), 4, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,16))), 4, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,16))), 4, '0'), '-', | |
LPAD(HEX(ROUND(rand()*POW(2,48))), 12, '0') | |
))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment