mysqlbackup - create everyday MySQL-databases backup




SYNOPSIS

       mysqlbackup [OPTIONS] [database [database [ ... ] ]]


DESCRIPTION

       mysqlbackup creates everyday MySQL databases backup


OPTIONS

       -a     Dump all available databases.

       -u user
              The MySQL user name to use when connecting to the server.

       -h host
              Connect to host.

       -p password
              Password  to use when connecting to server. You should note that
              specifying a password on the command line should  be  considered
              insecure.

       -P filename|ask
              Read  the  clear  password from the file. The file must normally
              not be readable by "others" and must contain exactly  one  line.
              Password  will  be prompted from the command line if the special
              keyword "ask" specified here.

       -o option|no
              Additional mysqldump option. To  specify  multiple  options  you
              should  repeat  this key for each mysqldump-option.  The default
              options are: --opt --skip-lock-tables --quote-names.  To not use
              the default options force "no" option.

       -l days
              Keep  created backups for the specified number of the days.  The
              default is 5 days.

       -d directory
              Target directory to archive backups.  The default is  /var/back-
              ups (will be created if need).

       -z gzip|bzip2|no
              Compress  dumps  with specified program.  The default compressor
              is bzip2(1).  Use special "no" keyword to disable compressing.

       -F mode
              Create files with given mode access  permissions.   The  default
              mode is 0600.

       -D mode
              Create  directories  with  given  mode  access permissions.  The
              default mode is 0700.

       -m path|yes|no
              Save my.cnf config or specify it alternate  path.   Default  is:
              yes, %%DATADIR%%my.cnf.

       -C yes|no|keys
              Check  tables  before  doing  backup  or  use specified keys for
              mysqlcheck(1) program  while  perfoming  check.   Default:  yes,
              keys: --auto-repair --check-only-changed --extended --silent.

       -O yes|no|keys
              Optimize  tables  before  doing backup or use specified keys for
              mysqlcheck(1) program while perfoming optimization.   Note  that
              not  all table engines supports table optimization. Please refer
              to "OPTIMIZE TABLE Syntax"  paragraph  of  MySQL  documentation.
              Default: yes, keys: --optimize --silent.

       -L lockfile
              Alternate  default path to lockfile (/var/tmp/mysqlbackup.lock).

       -t seconds
              Timeout in seconds to  expire  existing  lockfile.   By  default
              lockfile expires after 90000 seconds.

       -v     Be verbose.

       -V     Print version and exit.

       -H     Print this help and exit.


EXAMPLES

       mysqlbackup
              Do nothing, print help.

       mysqlbackup -av
              Verbose  backup  all the accessible databases on the local MySQL
              server.

       mysqlbackup -c no mysql
              Backup MySQL system database  without  output  dump  being  com-
              pressed.

       mysqlbackup -a -P ask
              You are prompted for password to backup all the databases.


USAGE

       mysqlbackup package comes with a number of periodic(8) scripts allowing
       to create periodic backups even more transparently. There is number  of
       options  suitable  for  periodic.conf(5)  that can be used to provide a
       more accurate configuration to run mysqlbackup:

       mysqlbackup_enable
              (bool) enables or disables mysqlbackup tool to  run  with  peri-
              odic(8).   The default is "no". If enabled, mysqlbackup will run
              by a daily schedule.

       mysqlbackup_schedule
              (str) run mysqlbackup either daily or weekly or monthly. As men-
              tioned above - the default schedule is daily.

       mysqlbackup_args
              (str)  pass  to  mysqlbackup  program  additional  arguments. By
              default they are set to -av,  which  means  to  backup  all  the
              available  databases.  Note  that  this  variable  automatically
              adjusted with -l option based upon  selected  mysqlbackup_sched-
              ule.  With  weekly schedule backups are stored for 30 days; that
              is, there will be at least four last backups  created  on  every
              Saturday,  for  example.  As for monthly schedule, backups stays
              untouched for 120 days, allowing to have minimum four last back-
              ups  created  on  the every first day (also, as example) of last
              months.

       If you need to create backups with a bit different schedule - just  add
       command  with  desired arguments and flags to your crontab(1) to create
       regular MySQL backups. In order to use mysqlbackup as periodic job - do
       not  forget  to  allow periodic(8) to run mysqlbackup by setting mysql-
       backup_enable to `yes' in either /etc/periodic.conf.local or /etc/peri-
       odic.conf file. Check periodic.conf(5) for details.


ENVIRONMENT

       MYSQL_PREFIX  environment  variable  specifies  your MySQL installation
       prefix. All used MySQL binaries (mysqldump, mysql, mysqlcheck) will  be
       searched within this prefix at `bin' directory.


SECURITY

       You should keep your password in secure.

       The  method  of  specifying  your MySQL password with -p option must be
       considered extremely insecure and should not  be  used.  Your  password
       becomes  visible  to  system  status programs such as ps(1) that may be
       invoked by other users to display command lines.

       Store your password in an option file. For example, you can  list  your
       password  in  the  [client]  section  of  the .my.cnf file in your home
       directory:

               [client]
               password=your_pass

       To keep the password safe, the file should not be accessible to  anyone
       but yourself. To ensure this, set the file access mode to 400 or 600.


AVAILABILITY

       The latest version of this distribution is available on-line from:

           http://www.renatasystems.org/freebsd/mysqlbackup.html


AUTHOR

       Written by Alexey V. Degtyarev


REPORTING BUGS

       Report bugs to <alexey@renatasystems.org>


SEE ALSO

       mysqldump(1), mysqlcheck(1), mysql(1), periodic.conf(5), periodic(8)



FreeBSD                            July 2009                    MYSQLBACKUP(1)

Man(1) output converted with man2html