Difference between revisions of "How to Create a MySQL Database Backup"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==How to Create a MySQL Database Backup== Create a backup is something you should do nightly or weekly, that way if the database ever crashes beyond repair you will have a ba...")
 
(No difference)

Latest revision as of 21:25, 12 March 2014

How to Create a MySQL Database Backup

Create a backup is something you should do nightly or weekly, that way if the database ever crashes beyond repair you will have a backup.

How to backup the entire database

Backing up the entire database

 mysqldump –u <username> –p <databasename> > dump.sql

Example:

mysqldump -u brian -p briansnelsonwiki > briansnelsonwiki-backupdate.sql

How to backup just a table in a database

Backing up just the users tables in database briansnelsonwiki

mysqldump -u<username> -p <databasename> <databasetable> > dumptable.sql

Example:

mysqldump -u brian -p briansnelsonwiki users > briansnelsonwiki.users-backupdate.sql