Taking backups using mysqldump
mysqldump
is a widely used logical backup tool. It gives a variety of options to include or exclude databases, select specific data to be backed up, back up only the schema without data, or just take a backup of stored routines without anything else, and more.
How to do it...
The mysqldump
utility comes along with the mysql
binary, so you do need to install it separately. Most production scenarios are covered in this section.
The syntax is as follows:
shell> mysqldump [options]
In the options, you can specify the username, password, and hostname to connect to the database, like this:
--user <user_name> --password <password> or -u <user_name> -p<password>
In this chapter, --user
and --password
are not mentioned in every example, to keep the reader focused on other important options.
Full backup of all databases
This can be done with the following:
shell> mysqldump --all-databases > dump.sql
The --all-databases
 option takes a backup of all...