Skip to content

Instantly share code, notes, and snippets.

@karansinghgit
Last active June 26, 2020 18:24
Show Gist options
  • Save karansinghgit/e177a31a64c01dd1ea27f6004007e652 to your computer and use it in GitHub Desktop.
Save karansinghgit/e177a31a64c01dd1ea27f6004007e652 to your computer and use it in GitHub Desktop.
Commonly Used MySQL commands for basic use-cases

USER RELATED

  • CREATE USER create user karan@localhost identified by 'password';
  • VIEW ALL USERS select user, host from mysql.user;
  • VIEW CURRENT USER select user();
  • DROP USER drop user karan@localhost
  • GRANT PRIVELEGES grant all privileges on *.* to karan@localhost with grant option;
  • SHOW PRIVILEGES OF A USER show grants;

SCHEMA RELATED

  • show databases
  • use database
  • show tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment