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

Leave a Reply

Your email address will not be published. Required fields are marked *


1 × = four

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>