Category Archives: System Administration

Backing up a MySQL MyISAM database using mysqldump.

Give the command,

[tony@localhost ~]$mysqldump --opt --user=username --password=
password --host=yourMySQLHostname dbname > output.sql

For bzipping it,

[tony@localhost ~]$mysqldump --opt --user=username --password=
password --host=yourMySQLHostname dbname | bzip2 -c > output.sql.bz2

To dump individual tables use the command,

[tony@localhost ~]$mysqldump --opt --user=username --password=
password --host=yourMySQLHostname dbname  (tablename tablename tablename) > output.sql

The --opt switch is a shorthand; it is the same as specifying --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset
It should give you a fast dump operation and produce a dump file that can be reloaded into a MySQL server quickly.

For more information on individual options refer man mysqldump