Skip to content

Instantly share code, notes, and snippets.

@mrLexx
Last active June 4, 2020 01:01
Show Gist options
  • Save mrLexx/4f6c002d821242ec70d0cbc27e98ffaf to your computer and use it in GitHub Desktop.
Save mrLexx/4f6c002d821242ec70d0cbc27e98ffaf to your computer and use it in GitHub Desktop.
Generate a random string in MySQL
SELECT SUBSTRING(REPLACE(REPLACE(REPLACE( TO_BASE64(MD5(RAND())), '=',''),'+',''),'/',''), 2, 8);
SELECT SUBSTRING(REPLACE(REPLACE(REPLACE( TO_BASE64(MD5(RAND())), '=',''),'+',''),'/',''), 2, FLOOR(10+RAND()*31));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment