Just replace the db name, username and password and paste the code into your terminal.
While this is a handy how-to, probably you'll want to perform frequent db exports and we'll cover that later in the series, in the cron job tutorial.
For backing up your web or blog files, refer to Part 10: Backup Sites & Blogs from the Command Line.
Dumping (that's exporting, not erasing) the data from the MySQL database is the same procedure whether backing up locally or remotely except that, remotely, of course you have first to access the server, as we covered in the VPS Bible, Set Up the Command Line Interface (CLI) using PuTTY.
Once logged into the terminal, don't bother further logging into the MySQL shell.
Just change directory to where you want to backup to, maybe creating a new folder (mkdir /path/to/new). So goto something like:-
And backup in there, using this syntax:-
You'll be prompted for your db password and, once entered, the backup is created, super-fast, and you're done.
So, if I've got a database called “work”, my username is “guv” and my password is “abc”, I could use something like this below. (The one possible variable is the name of the backup file, which I can call whatever I like) ..
Prompted, after entering the db password, I'm done.