blob: 91e049e85663d7305f0986710c8b44de164536a5 (
plain)
1 Performing a MySql Backup Via Command Line
2 ==========================================
3 :author: Aaron Ball
4 :email: nullspoon@iohq.net
5
6
7 == {doctitle}
8
9 A few months back I was running backups of the ol' web server and realized that
10 it was going to be a pain since I was starting to host more and more websites.
11 Logging into phpMyAdmin and exporting every database can be a bit cumbersome
12 when you have a lot of databases. With that, I wanted a good solution for
13 dumping my entire database server. Thankfully, the solution is a really simple
14 one (if you have console access). Many thanks to the MySql devs for creating
15 this feature (as if they wouldn't what good is a database you can't back up
16 after all).
17
18 As I mentioned, this is really simple. To export all of your databases
19 that you have running, including create statements, run the following
20 command...
21
22 ----
23 mysqldump -u root -p --all-databases > /tmp/dumpfile.sql
24 ----
25
26 So here's what we just did.
27
28 * *-u* root specifies the user. In this case, root is who we are logging
29 in.
30 * *-p* makes it ask for a password (it will try to log in without using
31 a password if this isn't used)
32 * *--all-databases* makes it export all databases (duh)
33
34 Ordinarily, this command outputs to the console. It's not the most useful thing
35 in the world unless you use the greater than. The > makes it write that output
36 to the specified location rather than to your console window.
37
38
39 Category:MySQL
40
41
42 // vim: set syntax=asciidoc:
|