Skip to content

Instantly share code, notes, and snippets.

@marcusthor
Created September 9, 2012 08:53
Show Gist options
  • Save marcusthor/3683385 to your computer and use it in GitHub Desktop.
Save marcusthor/3683385 to your computer and use it in GitHub Desktop.
Bash: MySQL Commands

Back up from the command line (using mysqldump)

mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]

Back up the MySQL database

mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz]

Restoring the MySQL database

mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment