mysql backup

Share your awesome tips and tricks here.

Moderator: Lillian.W@AST

User avatar
James.W@AST
Posts: 189
youtube meble na wymiar Warszawa
Joined: Wed Jun 06, 2012 12:50 am

Re: mysql backup

Post by James.W@AST »

by the way, mysqldump should be available since 1.0.9
To Infinity and Beyond!

Friends of My AS-606T: (RAID 5 with WD Black 2TB * 4, WD Red 2TB * 2)
MacBook Air (10.8) & Self-assembled Windows PC (Windows 7)
iPhone 4S (iOS 6) & iPad 2 (iOS 6)
Boxee Box, Logitech Squeezebox Duet
SONY HT-CT150 Sound Bar (Connected directly to the NAS via HDMI)
CISCO Linksys E4200
ho66es
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: mysql backup

Post by ho66es »

James.W@AST wrote:by the way, mysqldump should be available since 1.0.9
nice work :)
608t
atiras
Posts: 28
Joined: Wed Oct 02, 2013 6:37 pm

Re: mysql backup

Post by atiras »

I'm trying to use this script and testing it by executing it as root before I schedule it using cron. I get the following error:

Code: Select all

Backing up database performance_schema to /volume1/sqlbackup/mysql/performance_schema.sql\n
/volume1/sqlbackup/mysqlbackup.sh: line 74: /volume0/usr/builtin/sbin: Permission denied
The sql user and password exist and have all rights to all databases. (I've hard-coded these for now). I've also tried using no password and the root account for sql -- no joy.
The share sqlbackup exists and has RW access for everyone.

What else do I need to check?
ho66es
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: mysql backup

Post by ho66es »

atiras wrote:I'm trying to use this script and testing it by executing it as root before I schedule it using cron. I get the following error:

Code: Select all

Backing up database performance_schema to /volume1/sqlbackup/mysql/performance_schema.sql\n
/volume1/sqlbackup/mysqlbackup.sh: line 74: /volume0/usr/builtin/sbin: Permission denied
The sql user and password exist and have all rights to all databases. (I've hard-coded these for now). I've also tried using no password and the root account for sql -- no joy.
The share sqlbackup exists and has RW access for everyone.

What else do I need to check?
there was a bug in the script, I have uploaded v1.1 please try this one
608t
atiras
Posts: 28
Joined: Wed Oct 02, 2013 6:37 pm

Re: mysql backup

Post by atiras »

Thank you -- that works.
ho66es
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: mysql backup

Post by ho66es »

atiras wrote:Thank you -- that works.
glad to hear it is useful to someone :)
608t
sksbir
Posts: 395
Joined: Tue Aug 25, 2015 9:23 pm

Re: mysql backup

Post by sksbir »

ho66es wrote:Ok this is the script I am using from cron

cron entry is

Code: Select all

# backup prep
10 1 * * * /volume1/misc/mysqlbackup.sh
this is designed to be run before my backups to remote location so that the database is fully backed up daily and previous backups are archived. The backup dumps each database to a separate sql file and is commented where your install may differ from mine (I run the script from a share called misc, the backups go to a share called backup and the password for the backup user is stored in a file /etc/backuppass the only contents of that file are the password.

*updated script*
mysqlbackup.zip
please feel free to read and get back to me with any ideas for changes / fixes. If you choose to try this please understand I make no guarantees other than it works for me and on my austor and I will not be responsible if it damages the contents of your nas in any way etc etc.
Hello
Two corrections to do : replace LOC_C by LOG_C 2 times.
User avatar
Gunthor
Posts: 116
Joined: Sun Jun 23, 2013 6:04 pm
Location: Germany - Stuttgart

Re: mysql backup

Post by Gunthor »

Thank you ho66es - What a wonderful and highly professional solution. I love the system log entries. Works like a charm. I messed up 70 data records in one of my MySql databases today - managed to recreate them with quite some time - and was just looking for an automatic solution for regular updates. Again: "Thank you for sharing..." :D :D :D
Since 07/2023: Asustor AS6702T, (2 x Seagate IronWolf 12TB, RAID 1)
Old: Asustor AS-604RS, ADM 3.1.2.RHG1 (4 x WD Red WD30EFRX 3TB, RAID 5)
Post Reply

Return to “Tips & Tricks”