Skip to content

Instantly share code, notes, and snippets.

@mayurah
Last active May 20, 2016 03:41
Show Gist options
  • Save mayurah/139eb04db35d94d9ce5fb3dfb932d069 to your computer and use it in GitHub Desktop.
Save mayurah/139eb04db35d94d9ce5fb3dfb932d069 to your computer and use it in GitHub Desktop.
Miscellaneous MySQL queries
# Random Rating Generator
INSERT INTO tbl_name ( rating ) VALUES ( ROUND(rand() * 5,2) );
# Create user 'hackerearth' and password 'passphrase'
CREATE USER 'hackerearth'@'localhost' IDENTIFIED BY 'passphrase';
# Grant superuser privileges to db 'test', user 'hackerearth', and hostname 'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'hackerearth'@'localhost';
# To see privilages related changes in effect.
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment