Difference between revisions of "Backup MySQL"
Line 10: | Line 10: | ||
===Examples=== | ===Examples=== | ||
====Linux==== | ====Linux==== | ||
− | At the command line type mysqldump | + | At the command line type |
+ | |||
+ | Server:/ # mysqldump --single-transaction --quick retain > retain.date.sql -u root -p | ||
+ | |||
+ | Explanation of the command: | ||
+ | |||
+ | mysqldump The command to get started telling MySQL you want to make a dump file | ||
+ | |||
+ | --single-transaction and --quick: switches you want to apply, [http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html read up on it in the documentation mentioned above if you'd like to fiddle with it some more.] There's a lot you can tweak. | ||
+ | |||
+ | retain: This part is the database you want to export/dump | ||
+ | |||
+ | >(export to pointer, I.E. direction you're pushing the data) retain.date.sql (this can be | ||
====Windows==== | ====Windows==== |
Revision as of 17:50, 9 January 2015
This article is a very bare bones "dummy's guide" set of information. If you'd like to learn more check out the MySQL page on using MySQL dump: http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html Or this article on database backup methods if you'd like to look into other options. Plus there's a whole world of internet to search.
Contents |
MySQL dump
The mysqldump program bundled with MySQL is one of the best ways that has been found to backup a MySQL database.
For Retain you'll want to use the --single-transaction and possibly the --quick switch Check out the MySQL documentation on those switches here.
Using the --quick switch may depend on the size of your database, the bigger it is the more important it may become to use it for your dump script.
Examples
Linux
At the command line type
Server:/ # mysqldump --single-transaction --quick retain > retain.date.sql -u root -p
Explanation of the command:
mysqldump The command to get started telling MySQL you want to make a dump file
--single-transaction and --quick: switches you want to apply, read up on it in the documentation mentioned above if you'd like to fiddle with it some more. There's a lot you can tweak.
retain: This part is the database you want to export/dump
>(export to pointer, I.E. direction you're pushing the data) retain.date.sql (this can be