Last active
May 1, 2018 11:38
-
-
Save charlieanstey/ca963b14609a838bbfc6 to your computer and use it in GitHub Desktop.
#MySQL common commands
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 database | |
CREATE DATABASE name; | |
# Show databases | |
SHOW DATABASES; | |
# Use database | |
USE database; | |
--- | |
# Create user | |
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; | |
# Allow user access to entire database | |
GRANT ALL PRIVILEGES ON base.* TO 'user'@'localhost' IDENTIFIED BY 'password'; | |
GRANT SELECT, INSERT, DELETE ON base.* TO 'user'@'localhost' IDENTIFIED BY 'password'; | |
# Remove user access to database | |
REVOKE ALL PRIVILEGES ON base.* FROM 'user'@'host'; -- one permission only | |
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'host'; -- all permissions | |
# Remove password for root on localhost | |
SET PASSWORD FOR root@localhost=PASSWORD(''); | |
--- | |
UPDATE table SET column=`some value` WHERE something=true; | |
--- | |
DELETE FROM table WHERE something='this'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment