All,

I'm new to mysql.

I'm interested in writing a cron job to backup mysql that will:
 - Backup all the global information first (users and groups, typically)
 - Backup each database independently (not dumpall)



For postgres I can dump:

 - globals
        pg_dumpall -U $PG_ADMIN -g > $PG_BACKUP_DIR/globals.sql

 - databases

for database in $(psql -l -t -d template1 -U $PG_ADMIN | cut -f1 -d'|')
; do
    if [ $database = "template0" ] ; then
        continue  # we cannot backup or restore this database
    fi
                                                                                       
        
    # actually dump the database to a pg_dump "custom" file format...
    syslog debug "Attempting to backup database $database."
    pg_dump -f $PG_BACKUP_DIR/$database.custom -Fc -U $PG_ADMIN
$database
    if [ $? != 0 ] ; then
        syslog crit "CRITICAL Failed to backup database $database."
    else
        syslog info "Backed up database $database."
    fi
                                                                                       
        
done



Charles


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to