Skip to content

Instantly share code, notes, and snippets.

@gbarreiro
Created August 20, 2020 11:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbarreiro/88a2c81ec20cea3c59765efd6c94a784 to your computer and use it in GitHub Desktop.
Save gbarreiro/88a2c81ec20cea3c59765efd6c94a784 to your computer and use it in GitHub Desktop.
MySQL cheatsheet: create a database and assign permissions to users
-- Create the database
CREATE DATABASE University;
-- Use a database
USE University;
-- Assign permissions to a database
GRANT ALL ON University TO mike
GRANT INSERT, UPDATE ON University.Students TO william
GRANT SELECT(id, name) ON University.Teachers TO john
-- Remove a database
DROP DATABASE University;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment