[HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.8

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
Post Reply
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.5

Post by fribse »

I've gone through the script, this is not tested fully, but give it a try and see if it works.
Please report back what you find, and I'll release it in the first post if it's ok...

UPDATE: Version has been released.
Last edited by fribse on Thu Jun 09, 2016 4:44 pm, edited 1 time in total.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
nevaeh
Starting out
Posts: 12
Joined: Sat Aug 23, 2014 12:23 am

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.5

Post by nevaeh »

It looks like it works perfectly!

You my good sir, are amazing! :)
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.5

Post by fribse »

No problem, let's hope it works...
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
nevaeh
Starting out
Posts: 12
Joined: Sat Aug 23, 2014 12:23 am

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.5

Post by nevaeh »

Is there anything specific you would like me to provide to prove that it's working correctly? :)

I'd be happy to help.
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.5

Post by fribse »

No, but it would be nice if others report back so we can get it tested in different environments.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by fribse »

Hi nevaeh

I've made it a proper 3.6, thankyou for your help!
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
nevaeh
Starting out
Posts: 12
Joined: Sat Aug 23, 2014 12:23 am

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by nevaeh »

fribse wrote:Hi nevaeh

I've made it a proper 3.6, thankyou for your help!

I'm really, really sorry to bother you again. For some reason the script doesn't seem to be cleaning out older backups set by the config file. I currently have the config file at it's defaults, 6, 5, 3.

I've attached as much information as I could to hopefully assist and I thank you so much if you take a look at it.

Edit - My apologies, I have attached the configuration file as well! :)
You do not have the required permissions to view the files attached to this post.
Last edited by nevaeh on Mon Sep 05, 2016 12:53 am, edited 2 times in total.
datorexpert
Been there, done that
Posts: 778
Joined: Mon Nov 16, 2009 4:14 pm
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by datorexpert »

You need to attach the configuration file too.
QTS 4.1.n/4.2.n/4.3.n/4.4.n MANUAL
Submit QNAP Support Ticket - QNAP Tutorials, Wiki - Product Support Status - Moogle's QNAP FAQ help V2 - QNAP Security Advisory
When you ask a question, please include the following:
Data md_checker nasreport (release 20180525)
=
Model: TVS-873e -- RAM: 20G -- FW: QTS 5.1.1.2491 build 20230815 (used as main storage + applications)
WD60EFRX-68L0BN1(x6) / WD80EFAX-68LHPN0(x1) Red HDDs -- RAID5: 8x6TB -- Cold spare: None
=
Model: TS-453B -- RAM: 8G -- FW: QTS 4.4.1.0978 build 20190626 -- BROKEN
=
Model: SS-839 -- SOLD after 12 years use! Never lost ANY data!
=
13 years of QNAP experience + Asustor and WD!
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by fribse »

Hi Nevaeh
Sorry for not getting back to you sooner, had a mishap during a firmware upgrade, and had to get QNAP to help with getting the RAID's back, they did that, so now I can try and look into what is going on :-)
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by fribse »

First of, the easiest test, could you check if the command /bin/rm is present on the NAS?
Secondly, could you check if the command /bin/ls is present on the nas?
Thirdly, could you check if the command /bin/awk is present on the nas?
Fourthly, if the three commands are present, could you try and cd to the 'weekly' dir (via SSH), and run the command /bin/ls | /bin/awk 'NR>6'
To see if that lists the 'excess' files?

Did you try and run the mysqlbackup script from the command line?
I can see the config is almost default, could you maybe copy a fresh config file to the /etc/config folder? If you edit the config file on a windows box, please use a proper editor that doesn't convert it to windows format, something like PSPAD or NOTEPAD++ (not Notepad).
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
nevaeh
Starting out
Posts: 12
Joined: Sat Aug 23, 2014 12:23 am

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by nevaeh »

fribse wrote:First of, the easiest test, could you check if the command /bin/rm is present on the NAS?
Secondly, could you check if the command /bin/ls is present on the nas?
Thirdly, could you check if the command /bin/awk is present on the nas?
Fourthly, if the three commands are present, could you try and cd to the 'weekly' dir (via SSH), and run the command /bin/ls | /bin/awk 'NR>6'
To see if that lists the 'excess' files?

Did you try and run the mysqlbackup script from the command line?
I can see the config is almost default, could you maybe copy a fresh config file to the /etc/config folder? If you edit the config file on a windows box, please use a proper editor that doesn't convert it to windows format, something like PSPAD or NOTEPAD++ (not Notepad).
No worries about the late response, I'm just thankful you're willing to help me troubleshoot! :)

I ran through all the steps above and included screenshots as well, everything seems to work just fine except clearing out old backups for some reason. I'm not sure if this helps or not, but I can't just clear out the backups by highlighting them and deleting them through Windows Explorer (it claims I need permission from NAS\admin), I have to manually log in to the QNAP, open File Manager and delete them that way.
You do not have the required permissions to view the files attached to this post.
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by fribse »

Ok, that sounds like a rights issue then.
Could you please check the folders owner and rights?
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
nevaeh
Starting out
Posts: 12
Joined: Sat Aug 23, 2014 12:23 am

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by nevaeh »

fribse wrote:Ok, that sounds like a rights issue then.
Could you please check the folders owner and rights?
Each folders owner (mysql.daily, mysql.weekly, mysql.monthly) is: admin
Rights are: drwxr-xr-x

The files owner is: admin
Rights are: -rw-r--r--
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by fribse »

Hmm interesting, mine looks like this:
drwxr-xr-x 2 admin administ 4096 Sep 24 00:30 mysql/
drwxrwxrwx 2 admin administ 4096 Sep 24 00:30 mysql.daily/
drwxrwxrwx 2 admin administ 4096 Sep 2 00:30 mysql.monthly/
drwxrwxrwx 2 admin administ 4096 Sep 20 00:30 mysql.weekly/
Did you create them via SSH or CIFS?
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
nevaeh
Starting out
Posts: 12
Joined: Sat Aug 23, 2014 12:23 am

Re: [HOWTO] Make automatic backup of ALL MySQL databases V3.6

Post by nevaeh »

I let the script create them, the only thing I can think of is that my QNAP has some bizarre inherent permissions that it's pushing down.

I also tried setting the backup to a completely different drive/share and the permissions where the same as well.

The only thing I can think of is restoring to factory defaults and starting over... :(
Post Reply

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”