Last active
August 23, 2016 19:07
-
-
Save rdlmda/9040614 to your computer and use it in GitHub Desktop.
Some very basic MySQL operations
This file contains hidden or 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
| Some very basic MySQL operations |
This file contains hidden or 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
| # This comment continues to the end of line | |
| -- This comment continues to the end of line | |
| /* this is an in-line comment */ | |
| /* | |
| this is a | |
| multiple-line comment | |
| */ |
This file contains hidden or 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 user, a new DB and grant privileges on this DB | |
| CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; | |
| GRANT USAGE ON `database`. * TO 'username'@'localhost' IDENTIFIED BY 'password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; | |
| CREATE DATABASE IF NOT EXISTS `database` ; | |
| GRANT ALL PRIVILEGES ON `database` . * TO 'username'@'localhost'; |
This file contains hidden or 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
| mysqldump --databases -u [user] -p [database] | gzip > [filename.sql.gz] |
This file contains hidden or 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
| gunzip < [compressed_filename.sql.gz] | mysql -u [user] -p[password] [databasename] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment