miCRoSCoPiC^eaRthLinG
Nov 5 2005, 04:22 PM
Hi folks, I just came across this cool shell script called automysqlbackup which takes on certain parameters such as your user/pass/host address/database names and performs automatic daily/weekly/monthly backups of your databases as configured. The script is ready to run and need very little configuration - only in the top part: QUOTE #===================================================================== #===================================================================== # Set the following variables to your system needs # (Detailed instructions below variables) #=====================================================================
# Username to access the MySQL server e.g. dbuser USERNAME=dbuser
# Username to access the MySQL server e.g. password PASSWORD=password
# Host name (or IP address) of MySQL server e.g localhost DBHOST=localhost
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3" DBNAMES="DB1 DB2 DB3"
# Backup directory location e.g /backups BACKUPDIR="/backups"
# Mail setup # What would you like to be mailed to you? # - log : send only log file # - files : send log file and sql files as attachments (see docs) # - stdout : will simply output the log to the screen if run manually. MAILCONTENT="files"
# Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs]) MAXATTSIZE="4000"
# Email Address to send mail to? (user@domain.com) MAILADDR="user@domain.com"
# ============================================================ # === ADVANCED OPTIONS ( Read the doc's below for details )=== #=============================================================
# List of DBBNAMES for Monthly Backups. MDBNAMES="mysql $DBNAMES"
# List of DBNAMES to EXLUCDE if DBNAMES are set to all (must be in " quotes) DBEXCLUDE=""
# Include CREATE DATABASE in backup? CREATE_DATABASE=yes
# Separate backup directory and file for each DB? (yes or no) SEPDIR=yes
# Which day do you want weekly backups? (1 to 7 where 1 is Monday) DOWEEKLY=6
# Choose Compression type. (gzip or bzip2) COMP=gzip
# Command to run before backups (uncomment to use) #PREBACKUP="/etc/mysql-backup-pre"
# Command run after backups (uncomment to use) #POSTBACKUP="/etc/mysql-backup-post"
- where you set your mysql access params and database list. Next you simply put this script on your CrobTab and forget about it. It's a real cool tool to have and I believe since most of you can access your hosting accounts using the Java based SSH Client in your cPanel, setting this up wouldn't be any problem at all. Even other wise, you can set the parameters and upload it via FTP and then add it to your cron table using cPanel. Have fun  and any questions about configuring it - most welcome. Attached .txt file contains the script. Simply rename it to automysqlbackup.sh and chmod +0775 or, alternatively it can be directly obtained from SourceForge.Net @ http://sourceforge.net/projects/automysqlbackup/Click to view attachment
Reply
warbird
Nov 5 2005, 05:41 PM
Wow, very cool M^e, I don't work much with MySql yet, but I'm planning to use it for my next. (can't tell you what site, top secret  ) Anyway, this is gonna be useful for me. Thanks for the code. One tiny thing. Could you tell us the source please? I wanna look at it, maybe it got some more interesting scripts. -=jeroen=-
Reply
miCRoSCoPiC^eaRthLinG
Nov 5 2005, 05:56 PM
Check out that SourceForge link. That's where I found it while browsing SourceForge. This guy wrote just one script I think, although you might find others in similar categories. Just browse the sourceforge archives. I'll list if I come across any more.
Reply
yordan
Nov 6 2005, 05:31 PM
Does this script work at astahost too ? Or do you need to have console access in order to fire it ?
Reply
ruben
Nov 6 2005, 09:50 PM
Err read the last part of m^es post again. Yes it is compatible with Astahost, you have to set it up as a cronjob, he explained how. Sorry for double posting but I was having some issues configuring this and I need help with it. 1. Is daily backup considered resource exploitation? What's the limit? 2. Which path do I have to specify in the CronTabs in order to let it find the file to be executed? I tried /home/ruben/etc/cron.daily and etc/cron.daily, neither worked, I get Emails like this QUOTE # #: bad interpreter: No such file or directory to my astahost mail account. 3. Would it be easier to set it up using SSH, now that I have it?If it's only a path issue, probably not, but there is also the writing permission thing, etc. 4. What does the script do when the database files get to big for email? Split em or not send them at all?Since I never got it to work, I was wondering, what I'll get. Thanks!
Reply
saint-michael
Dec 22 2005, 11:18 PM
interesting find you found m^e this would be a good script for people running forums. but on ruben questions 4th one in partical you can set up the size of the email that you think will best fit with what you have you Mysql dbs doing. CODE # Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs]) MAXATTSIZE="4000"
QUOTE 2. Which path do I have to specify in the CronTabs in order to let it find the file to be executed? I tried /home/ruben/etc/cron.daily and etc/cron.daily, neither worked, I get Emails like this I believe the script makea s complete backups the dbs that you want to list CODE # List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3" DBNAMES="DB1 DB2 DB3"
the question i have are you loading hte script through phpmyadmin on are you putting it in your file manager to be run?
Reply
ruben
Dec 24 2005, 10:27 AM
Thanks for trying to answer my questions, but you misunderstood me in every aspect. I know that I can set a max. attachment size, but what will the script do as soon as the database exceeds the limit? Stop sending emails or start splitting them? I know, that the script is supposed to make database backups. The question asked was: Which path do I have to specify in the crontab in order for it to find the cronjob file? If I have my cronjob named "cron.daily" in the folder home/ruben/etc/, how do I have to specify the path in the crontab? I've tried various (home/ruben/etc/cron.daily, /etc/cron.daily, etc/cron.daily), but neither worked (once there was a permission problem first, but then it didn't find it again). To answer your question:You specify the variables in the script, then you save it in some not-publicly accessable folder on your website like /home/saint-michael/etc/ (the file name/ending is not important). Then you specify the file to be called in the crontab. And THEN you get to all my problems.
Reply
Shadow X
Dec 25 2005, 04:08 PM
Very useful...thanks so much for that script miCRoSCoPiC^eaRthLinG. I always forget to backup my MySQL databases, and now that I have this code...I don't have to!
Reply
soccerdvl18
Dec 26 2005, 12:24 AM
this stuff is very useful for me right now, but im having a lil trople finding things right now but that doesnt matter. thanx a lot of i was lookin how to bak up mySQL database
Reply
ruijietan
Dec 26 2005, 05:31 AM
Thanks a lot for the script.
Reply
Recent Queries:--
mysql automatic daily backup - 15.93 hr back. (1)
-
slq server query daily backup code - 24.48 hr back. (1)
-
php daily backup - 27.16 hr back. (1)
-
how to backup mysql daily - 34.75 hr back. (2)
-
remove data mysql row weekly - 38.67 hr back. (1)
-
backup mysql daily - 40.61 hr back. (1)
-
schedule mysql to backup daily - 52.89 hr back. (1)
-
mysql how to take daily backup - 55.02 hr back. (1)
-
mysql how to do daily backups - 60.77 hr back. (1)
-
mysql replication daily - 62.12 hr back. (1)
-
mysql daily weekly backups - 69.40 hr back. (1)
-
auto mysql backup ragezone - 73.57 hr back. (1)
-
mysql how to get backup size - 80.89 hr back. (1)
-
mysql how can set the maximum bakup size of the attachement - 81.55 hr back. (1)
Similar Topics
Keywords : auto backup mysql dbs daily weekly monthly- MySQL Realtime Replication
- how to replicate mysql in realtime (4)
i dont know if this might be useful to ppl here, but this is a very good knowledge for serious
siteadmins. while i was digging for mysql backup techniques, i've found that mysql is able to
do realtime replication. the idea is that there are master server and slave server. both are having
the same version of mysql installed. the data flows; Master >copy> Slave ( in realtime!)
you'll never have to manually copy the database file of wasting your time to manually use the
mysqldump command. here are the links; http://dev.mysql.com/doc/mysql/en/Replication_HOW...
Navcat For MySQL
- is Navcat any good? (8)
Hello all, i ve recently come across NavCat (GUI tool) for MySQL. I have not bought a copy yet, just
played around with the demo. Has any one used it beore, if so please let me know if its worth
buying. I already have PhpMyadmin, Just wanna know if NavCat is better than PhpMyAdmin in usibility
and functionality. Regards...
MySQL Output Database Question
- (18)
I am new to MySql and have just created a database after using a script. My problem is not the
script, but what it says about putting it into the output file. I cant figure out the right terms
to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
please help me out?...
Any Website Provide Free Host Mysql Host?
- (4)
any website provide free host mysql host? i need it because i am using 000webhost.com now but it
only provide 2 mysql database... can i know where or how can i get more databases regards...
Recover Tables From A MySQL .frm File
- (8)
I have a couple of .frm files with no corresponding data or index files. Is it possible to recover
the table structure (field names, types, sizes, rows,col, etc) from these files? The table type is
innodb...
Mysql Multiple Tables
- (1)
Login System Using A Mysql Db
- How do i do this? (5)
Hi guys, ive got a registration system that looks something like the one below: Firstname:
Lastname: Then i have inset.php, which looks like the following: $con =
mysql_connect("localhost","autobot","abc123"); if (!$con) { die('Could not connect:
' . mysql_error()); }mysql_select_db("my_db", $con);$sql="INSERT INTO person
(username, password) VALUES ('$_POST ','$_POST ')";if
(!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record
added";mysql_close...
MySQL, Multiple Tables
- (24)
Ok, I'm coding a project which is a leap than what I'd normally do. Before, I've always
learned ONE table... put EVERYTHING in one database table. I'm making a profile system so there
needs to be at least two tables: 1 for users, 1 for content. My problem is, how do I link the two
together? I could probably figure this out faster if someone explained and posted sample SQL code
that shows how the two are linked together. Thanks!! F...
Mysql Database Entry By Excel Sheets
- (2)
Hello .. I would like to ask if i can use use Microsoft excel files in order to make entries to
mysql database. Thanks...
Mysql On Computer
- XD (9)
I posted PHP on computer? , but for some reason it doesn't show :/. Anyways I am wondering if
there is MYSQL on my computer, meaning can i make a data base on my computer? that way i make what i
want and upload it when i get hosted =)...
MySQL - Trouble With Bulk Insert Statements
- (3)
I'm trying to insert about 500 rows into mysql, but I keep getting errors. If I copy and paste
too many (about 50) insert statements at a time I get errors sometimes. I sometimes even get errors
but then the row is skipped so I don't know there was an error (I'm using linux and SSH).
What's the best way to get my insert statements to put the data in MySQL? Is there anyway that I
can have it tell me if there where any errors all the statements are executed? Thanks for your
help....
Mysql Database Management
- (1)
Hi i am new, I have a problem in understanding the query decomposition in D-DB. Can anyone help me
to understand the first question of the exercise 25.21 of Elmasri-Navath 4th edition? Consider the
following relations: BOOKS (Book#, Primary_author, Topic, Total_stock, $price) BOOKSTORE
(Store#, City, State, Zip, Inventory_value) STOCK (Store#, Book#, Qty) Consider a distributed
database for a bookstore chain called National Books with 3 sites called EAST, MIDDLE, and WEST.
Consider that BOOKS are fragmented by $price amounts into: B1:BOOK1:up to $20....
Mysql And User File_priv
- (0)
HI, I've hit the grain while trying to import file to mysql database - I need to enable file
permissions of the database user but this seems not possible with most of the hosting providers.
The problem is to set file_priv of the database user to "Y" . This is done in the "user" table of
the maintanance database named "mysql". cPanel doesn't allow this. Via the cPanel you can only
allow privileges on table querries but you cannot grant host file privileges to the database user -
which makes querries like: "LOAD DATA INFILE 'filename' INTO TABLE tablen...
I Have An Error With My Mysql Connection
- mysql connection error (7)
ok so here's my web page... http://lacrossems.t35.org/ it only lags cause its trying to
connect to the my sql server...i followed this guide
http://forum.ragezone.com/showthread.php?t=387249 and when i edit my config.php to my host and
login info i always get the error cannot connect to the database here is my config.php if you can
help me CODE <?php $host['naam'] =
'CENSORED'; // my host $host['gebruikersnaam'] =
'righto'; // my database username $host['wach...
Mirror My MySQL Database To Another Mysql Server
- (4)
Hi..I want to ask if its possible to automatically mirror my mysql databases into another mysql
server?or create a small php script to do this? The reason is because, we all know that database is
very improtant if we have dynamic website. I have my forum hosted and i want to automatically
mirror this or backup into another mysql server(free). Like in freesql.org. So that im not afraid
that i forgot to backup my database..also i have one central backup database. Thanks for the
help..Im looking forward for this posibility....
Mysql - So Hard
- Come in here if you think MySQL is soo hard! (14)
Doesn't anybody think MySQL is so hard to code? I mean think about it, you need loads of
databases just for one little script and you have to type things in like ;Host-Username:
(blahblah) ;Host-Password: (blahblah) ;Host-DatabaseName: (blahblah) Ok, that MySQL code was
random, and it is alot harder than that. If you have expierenced it being hard, you are free to
post right in here, mate....
Mysql And Php
- When trying to install Joomla (15)
I don't know if this is the correct forum, but here is my question: I'm trying to test
Joomla and some forums in my computer, I have already installed MySQL with the GUI tools, Apache,
and PHP with the MySQL and MySQLi extensions, but when I'm trying to install Joomla I get this
error: Required Settings Check: ------------------------------------- PHP version >= 4.1.0
Yes - zlib compression support Available - XML support Available - MySQL support
Unavailable configuration.php Writeable Session save path Unwriteable Not ...
Mysql Backup With Another Address?
- (4)
I just got my site hacked!! (don't worry because it is not on astahost) Actually it is a
wordpress blog. So I backed up my MySQL Databases with cpanel. Now when I get my hosting approved
here at astahost, can I restore those backups? Is the change of the site address going to interfere
with this? Is there anyway I can edit those databases to work with my new address? Please help me
out here!...
Sun Bought Mysql
- (6)
SUN bought the swedish company MYSQL for much money, around 2million each worker got in the company,
they did it to come in to the database market, is it a good reson to buy it?...
How To Connect MySQL With Flash?
- Help me connect my flash Work with MySql (8)
I know Flash and mysql but could not figure out if I could ever connect these? I want to have a
dynamic content in my flash object that could be retrieved from the database directly without myself
needing to update it again and again. How can I achieve this ? Do I have to install any additional
controls or connectors to do that ? If yes any one tell me...
Stop AUTO_INCREMENT From Jumping
- (13)
One of my MySQL tables has an ID column - it's a primary key with auto_increment. And it works.
If I add six rows they number 1 to 6 nicely. But if I delete rows 4 to 6 then add a new row, it
becomes row 7. And if I delete that it becomes row 8. How can I make it so the next auto_increment
is the smallest possible? (i.e. 1,2,3,4,5,6 - I delete 4-6 and the next row inserted becomes 4)...
Permission Problem With Mysql Database Creation
- Please Help! (8)
I seem to have a problem with accessing my database with proper permissions. I have set the my
database correctly giving my db username all priviliges yet i seem to be unable to even log on with
this username with a denied access error. Any ideas on resolving this?...
Auto_increment Jumping About
- not sequential numbers (3)
Hello, I've been having very strange problems with AUTO_INCREMENT. It will be sequential for
the first 4 or so inserts and display them fine. After 3 or 4 or 5 inserts the FileID, which has the
AUTO_INCREMENT applied to it, will then jump to a seemingly random number like 72, 49207, and so on.
My SQL for the table in question is: CREATE TABLE `IPR` ( `FileID` int(11) NOT
NULL auto_increment, `Filename` varchar(40) NOT NULL, `ContentType` varchar(15)
NOT NULL, `Description` varchar(150) NOT NULL, `Status` ch...
Mysql Problem
- Linking tables (1)
Hello guys, I'm making a PHP/MySQL site for a friend of mine who plays an online game where you
can create towns, add buildings to them and upgrade them to a newer level. I've offered to make
him a small site where he can input his data into a database and keep track of his towns, buildings
and levels. I'll show you my database design and then explain what i want to do. Table: towns
field 1: TownID (primary key, auto-increment) field 2: TownName field 3: TownType field 4: Town
Description Table: buildings field 1: BuildingID (primary key, auto-incremen...
Oracle Vs. Mysql Vs. Postgresql
- POLL!! Choses you preferred db s/w! (9)
Hey Everyone!, Please choose your preferred database s/w! Regards, Avell...
Apache Php With Mysql On Windows [solved]
- (9)
I have problems running PHP MySQL function in a windows set web environment. PhP scripts are
executed but if I try to use mysql connect and other like functions I get a blank window (while
using the browser). The command line client is working...I've added the path to libmysql.dll
and the extension=php_mysql.dll in the php.ini....
Subqueries In Mysql
- Using subqueries in MySQL. Very helpful. (1)
This method is very useful. I always use this when simple queries of linking two tables is not
enough. This method is putting a query inside a query. Example: SELECT * FROM table1 LEFT JOIN
(SELECT * FROM table2 WHERE field1='id') AS subtable or joining multiple queries SELECT *
FROM (SELECT * FROM table1 WHERE userid='001') AS subtable1 LEFT JOIN (SELECT * FROM table2
WHERE field1='id') AS subtable2 You can join more than two queries depending on the output
you want. If someone already posted this topic here I'm sorry I don't know....
Not Understanding Mysql
- (4)
Im not understanding MySql stuff can someone help me when u got to the MySql site and all that other
stuff is this like a log of your web stuff or does it help u desigen your website just wanted to
know what it does and how do u use this thing....
Mysql Script Help
- help me lol, (3)
ok im a real noob to this myswql stuff i know what its for but can any1 write me a script for it for
user sigh up and like a myspace type of profile with a forms peferbly Wii FC code Games. Also can
some1 explain how to add the forms if it doset bother u guys too much TY...
Problems With Php Saving Data Into Mysql
- HELP! I can't get my php documents to work with the mySQL (6)
i have a server that says it allows php and mysql and in the control panel i can access mysqladmin
and phpmyadmin but i cant get the php to save data into the mysql, i am trying to make a text-based
MMOG so i need to save my users/passwords into a database(i thought) and it won't do it, can
anyone help me...
Looking for auto, backup, mysql, dbs, daily, weekly, monthly
|
|
Searching Video's for auto, backup, mysql, dbs, daily, weekly, monthly
|
advertisement
|
|