Skip to content

Instantly share code, notes, and snippets.

@spnkr
Created September 5, 2009 22:45
Show Gist options
  • Save spnkr/181536 to your computer and use it in GitHub Desktop.
Save spnkr/181536 to your computer and use it in GitHub Desktop.
backup:
mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]
compress:
mysqldump --all-databases | gzip >databasebackup.sql.gz
restore:
mysql -u [username] -p [password] [database_to_restore] < [backupfile]
restore from archive:
gunzip < custback.sql.sql.gz | mysql -u [username] -p [password] [database_to_restore]
grant user permissions
GRANT ALL PRIVILEGES ON mydatabase.* TO bob@localhost IDENTIFIED BY 'fruitfly';
INSERT IGNORE INTO new_tbl SELECT * FROM orig_tbl;
CREATE TABLE new_tbl SELECT * FROM orig_tbl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment