|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
script to backup mysqldatabase
Hi,
I need a script for Solaris to perform a mysqldump of a database and have the name represent the day of the week. I have this script but it was written for linux. $day = getDate(); $system_call = "mysqldump --all-databases > /dir/filename".$day.".sql" I am not a scriptor and want to know if there is a script for this. Thanks Christine |
|
#2
|
||||
|
||||
|
the script you're looking at there is probably written in perl, and is only partially complete...
I would use the following statement in a cron job to back up a database with the name 'dbname' on host 'nikita'. Note the use of --add-drop-table, which means that table drop statements are added to the dump, so that you don't have to drop a database before restoring it.: Code:
# back up database at 6am 00 6 * * * /usr/local/mysql/bin/mysqldump --add-drop-table -hnikita -uchristo -p**** dbname> /export/backups/spiration/spiration-`date "+%"`.sql hth, christo
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
|
#3
|
|||
|
|||
|
or use hotcopy
if you are running your backups on a live database, you really want to consider hotcopy (which comes with mysql)
http://www.mysql.com/doc/en/mysqlhotcopy.html better still, though, is to run two mysqls on two different machines and replicate your data over the network so you always have a live backup. requires mysql 4.0 or higher (well, not really, but doing it on 3.x is a pain) http://www.mysql.com/doc/en/Replication.html
__________________
[frymaster] |
|
#4
|
|||
|
|||
|
thanks, I will look into it.
|
|
#5
|
|||
|
|||
|
I have 2 servers running mysql and a cronjob that does a mysqldump to a file and then backs up the file. On one server where there is no root password on the database, the dump works. On the server with the root password for the mysql database, the cron job runs but generates an empty dump file. If I run the same backup script manually, it dumps correctly. When it runs as a cron job, it dumps to a zero length file. I do not see any errors. Any ideas
|
|
#6
|
|||
|
|||
|
Quote:
I'd like more info about how to use mysqlhotcopy. Can I run it the same way I would mysql dumb just switch them around? Is there no way to do a actual copy of a database onto or over another database? |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > script to backup mysqldatabase |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|