[HOWTO] Make automatic backup of ALL MySQL databases

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.

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

Postby jm45 » Mon Sep 21, 2009 4:54 pm

Hi,
after NAS reboot is done, backuppass file is no more in my /etc
is it on purpose we have to re-create it?
context: TS-109 II firmware version: 3.1.0 Build 0708T
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

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

Postby fribse » Mon Sep 21, 2009 8:05 pm

Hmm, no. Darned, now where should we put it?
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
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

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

Postby jm45 » Tue Sep 22, 2009 5:17 am

inside the script itself .... 8)
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

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

Postby fribse » Tue Sep 22, 2009 6:57 pm

Move the password file to /etc/config, I'll update the script, and the instructions...
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
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

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

Postby jm45 » Wed Sep 23, 2009 2:04 am

Hi,
new 2.1 script tested ok; "Backup Successfull"
(but i have not still done the reboot test to check if backuppass is kept)

just a remark about old comment remaining:
MYSQL_USER="backup" # User for accessing the databases, password stored in the file /etc/backuppass
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

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

Postby fribse » Wed Sep 23, 2009 4:47 am

Ok, fixed :-) Didn't do a new version, just changed the comment. Thanks.
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
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

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

Postby techman » Fri Sep 25, 2009 3:19 pm

Well done Job! Thanks.
Techman
My First Qn TS-239 Pro
Teaching is learning - Help others to help yourself
techman
Starting out
 
Posts: 19
Joined: Sun Aug 30, 2009 7:17 pm
NAS Model: TS-639 Pro

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

Postby hellsblade » Wed Sep 30, 2009 2:09 am

Great script. At last. This should be integrated in the admin interface by default. Qnap guys... do the right thing.
I have a question also. For some reason the script claims there is an arc database, but it doesn't exist.
When i look with mysql admin there its not there. Any idea?

mysqldump: Got error: 1044: Access denied for user 'backup'@'localhost' to database 'arc' when selecting the database
ERROR creating new backup when trying to access the database arc

Rgrds,
hellsblade
hellsblade
Starting out
 
Posts: 36
Joined: Fri Oct 26, 2007 10:47 am

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

Postby fribse » Thu Oct 01, 2009 3:30 am

Thankyou for the kind words, nice to know that somebody else than me, and a few select users, benefits of it.

You have a directory under the mysql database directory called arc.
There should only be databases under the mysql database directory!
If you've made a backup or archive and put it in a directory there, move it elsewhere.
It doesn't use a list of databases, it just looks for the available directories.
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
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

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

Postby hellsblade » Fri Oct 02, 2009 6:25 am

fribse wrote:Thankyou for the kind words, nice to know that somebody else than me, and a few select users, benefits of it.

You have a directory under the mysql database directory called arc.
There should only be databases under the mysql database directory!
If you've made a backup or archive and put it in a directory there, move it elsewhere.
It doesn't use a list of databases, it just looks for the available directories.


There is indeed an arc directory in one of the database directories (PHPBB). It seems it has something to do with this bug. http://bugs.mysql.com/bug.php?id=17823, because i never put i there. I moved it out and i hope it does'nt come back.

Maybe its an idea to let the script send an email when there's an error encountered.

Rgrds,
Hellsblade
hellsblade
Starting out
 
Posts: 36
Joined: Fri Oct 26, 2007 10:47 am

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

Postby fribse » Mon Oct 05, 2009 2:18 am

I'm looking into getting the list of databases from the mysql command, and I've so far found a way, but for some reason, the while loop fails, hmmm.

Code: Select all
# Listing all the databases

echo 'show databases;' | mysql -u username--password=password | sed '1d' | while read LINE
do
  echo "Backing up database $LINE to /mysql/$LINE.sql"
done


Anybody that can tell me what I'm doing wrong here?

I would love to be able to send a message to the log of the server, but I'm not aware of how to do that...
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
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

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

Postby Don » Wed Oct 21, 2009 12:25 am

Hi fribse,

Going to give your script a try. Great work BTW.

I would love to be able to send a message to the log of the server, but I'm not aware of how to do that...

Use the following command to write to the system log file

Code: Select all
/sbin/write_log "your message here" [1 | 2 | 4]

1 = an error message
2 = a warning message
4 = an informational message

Don
Search (upper right hand corner) before posting.

Unofficial QNAP How-To Guide: http://forum.qnap.com/viewtopic.php?f=11&t=10622
How-To increase raid rebuild speed: http://forum.qnap.com/viewtopic.php?f=11&t=10268
How-To install dnsmasq: http://forum.qnap.com/viewtopic.php?f=90&t=26395

NAS: TS-509 F/W 3.6.1.0302 | TS-419P+ F/W 3.8.2.0301 | TS-639 F/W 3.6.1.0302 | TS-669 F/W 3.8.2.0301
QPKG: ipkg, LMS 7.7.1, PhpGedView, phpMyAdmin, WordPress, Xdove 1.3
IPKG: atop, busybox, dnsmasq, flac, htop, lame, less, libid3tag, lsof, man, man-pages, unzip, wakelan
OTHER: crontab, phpXmail, SpeedTest
N/W: Asus RT-N16 router w/dd-wrt | SMC gigagit switch
User avatar
Don
Moderator
 
Posts: 5587
Joined: Thu Jan 03, 2008 4:56 am
Location: Long Island, New York
NAS Model: TS-509 Pro

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

Postby Don » Wed Oct 21, 2009 12:34 am

Hi

I know you were looking for a way to determine the default volume. This will work.

Code: Select all
/sbin/getcfg Public path -f /etc/config/smb.conf -u | cut -f 3 -d '/'

Don
Search (upper right hand corner) before posting.

Unofficial QNAP How-To Guide: http://forum.qnap.com/viewtopic.php?f=11&t=10622
How-To increase raid rebuild speed: http://forum.qnap.com/viewtopic.php?f=11&t=10268
How-To install dnsmasq: http://forum.qnap.com/viewtopic.php?f=90&t=26395

NAS: TS-509 F/W 3.6.1.0302 | TS-419P+ F/W 3.8.2.0301 | TS-639 F/W 3.6.1.0302 | TS-669 F/W 3.8.2.0301
QPKG: ipkg, LMS 7.7.1, PhpGedView, phpMyAdmin, WordPress, Xdove 1.3
IPKG: atop, busybox, dnsmasq, flac, htop, lame, less, libid3tag, lsof, man, man-pages, unzip, wakelan
OTHER: crontab, phpXmail, SpeedTest
N/W: Asus RT-N16 router w/dd-wrt | SMC gigagit switch
User avatar
Don
Moderator
 
Posts: 5587
Joined: Thu Jan 03, 2008 4:56 am
Location: Long Island, New York
NAS Model: TS-509 Pro

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

Postby Don » Wed Oct 21, 2009 12:43 am

hi,

Why does the destination have to be a share?

Don
Search (upper right hand corner) before posting.

Unofficial QNAP How-To Guide: http://forum.qnap.com/viewtopic.php?f=11&t=10622
How-To increase raid rebuild speed: http://forum.qnap.com/viewtopic.php?f=11&t=10268
How-To install dnsmasq: http://forum.qnap.com/viewtopic.php?f=90&t=26395

NAS: TS-509 F/W 3.6.1.0302 | TS-419P+ F/W 3.8.2.0301 | TS-639 F/W 3.6.1.0302 | TS-669 F/W 3.8.2.0301
QPKG: ipkg, LMS 7.7.1, PhpGedView, phpMyAdmin, WordPress, Xdove 1.3
IPKG: atop, busybox, dnsmasq, flac, htop, lame, less, libid3tag, lsof, man, man-pages, unzip, wakelan
OTHER: crontab, phpXmail, SpeedTest
N/W: Asus RT-N16 router w/dd-wrt | SMC gigagit switch
User avatar
Don
Moderator
 
Posts: 5587
Joined: Thu Jan 03, 2008 4:56 am
Location: Long Island, New York
NAS Model: TS-509 Pro

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

Postby fribse » Sun Oct 25, 2009 4:13 am

Don wrote:Hi fribse,

Going to give your script a try. Great work BTW.

I would love to be able to send a message to the log of the server, but I'm not aware of how to do that...

Use the following command to write to the system log file


Hi Don

Excellent, just what I was looking for, I'll be incorporating it right away :-)

Thanks
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
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

PreviousNext

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

Who is online

Users browsing this forum: No registered users and 2 guests