Last active
May 10, 2024 23:51
-
-
Save csdy/bff3aecedc560c8cb47eb43a5edb8c90 to your computer and use it in GitHub Desktop.
MySQL Cheatsheet
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
-- Create a new database | |
CREATE DATABASE database_name; | |
-- Create a new user | |
CREATE USER 'username'@'%' IDENTIFIED BY 'password'; | |
-- Allow user connections to server | |
GRANT USAGE ON *.* TO 'username'@'%'; | |
-- Grant user privileges on database | |
GRANT EXECUTE, SELECT, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `database_name`.* TO 'username'@'%'; | |
-- Flush privileges | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment