Skip to content

Instantly share code, notes, and snippets.

@azder
Last active August 29, 2015 14:02
Show Gist options
  • Save azder/e54c0d31289e39bc2193 to your computer and use it in GitHub Desktop.
Save azder/e54c0d31289e39bc2193 to your computer and use it in GitHub Desktop.
Databases
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/
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