Last active
February 11, 2018 11:01
-
-
Save albankora/1569364e16b5b9bd5f4c to your computer and use it in GitHub Desktop.
Basic 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
# Download Files from remote to local | |
scp -r user@host:/path/to/remote/folder /path/to/local/folder | |
# MYSQL | |
#log to mysql cli | |
mysql -u {username}-p | |
#List all databases | |
SHOW DATABASES; | |
#List all tables | |
SHOW TABLES; | |
#List all tables table information | |
SHOW TABLES STATUS; | |
#Create a new databases | |
CREATE DATABASE {database name}; | |
#Create user | |
CREATE USER '{user}'@'{host}' IDENTIFIED BY '{password}'; | |
#Grant all database privileges to user | |
GRANT ALL PRIVILEGES ON *.* TO '{user}'@'{host}'; | |
#Give full access to one database | |
GRANT ALL PRIVILEGES ON {database name}.* TO '{user}'@'{host}'; | |
#Grant a specific user with a permission | |
GRANT {type of permission} ON {database name}.{table name} TO '{user}'@'{host}' | |
#To remove permissions | |
REVOKE {type of permission} ON {database name}.{table name} FROM '{user}'@'{host}'; | |
#Each time you update or change a permission be sure to use the flush privileges command | |
FLUSH PRIVILEGES; | |
#Drop user | |
DROP USER '{user}'@'{host}'; | |
#Logout from MYSQL CLI | |
quit | |
#Export mysql database | |
mysqldump -u {username} -p {database name} > {dumpfilename.sql} | |
#Import mysql database | |
mysql -u {username} -p {database name} < {dumpfilename.sql} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment