Last active
August 29, 2015 14:02
-
-
Save azder/e54c0d31289e39bc2193 to your computer and use it in GitHub Desktop.
Databases
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
mysqldump -u USERNAME -pPASSWORD DBNAME > DBNAME.sql | |
mysqldump -uUSERNAME -p DBNAME | gzip > DBNAME-$(date +"%Y-%m-%d-%H-%M-%S").sql.gz | |
mysqldump --all-databases -uroot -p | gzip > mysql-alldbs-$(date +"%Y-%m-%d-%H-%M-%S").sql.gz | |
mongodump -dDBNAME -o DIRNAME | |
mongorestore --drop -d DBNAME DIRNAME/ |
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 dbname CHARACTER SET utf8 COLLATE utf8_general_ci; | |
CREATE USER 'username'@'%' ; | |
SET PASSWORD FOR 'username'@'%' = PASSWORD('password'); | |
GRANT USAGE ON *.* TO 'username'@'%' | |
GRANT ALL PRIVILEGES ON `dbname`.* TO 'username'@'%'; | |
CREATE USER 'username'@'localhost'; | |
SET PASSWORD FOR 'username'@'localhost' = PASSWORD('password'); | |
GRANT USAGE ON *.* TO 'username'@'localhost'; | |
GRANT ALL PRIVILEGES ON `dbname`.* TO 'username'@'localhost'; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment