date +"%Y.%m.%d.%H.%M"`
as part of the result filename so that the filename includes a timestamp. The resulting compressed SQL dump file will be given a name like
2006.08.16.06.08.MySQL_Backup.sql.gz;
Check that your changes have been saved by typing
crontab -l(the "l" stands for list).
It’s also useful to first test the command yourself from the shell prompt. When
entering the command in the crontab file, use a time that’s near so that you can monitor that things are working as you expect. There are few things more depressing than finding that your regular backups weren’t being done properly, and that you can’t recover your lost data. You can edit the file again later and set the regular backup times you actually require.
Any output messages from the automatic execution are generally emailed to the
crontab owner you can specify a different
address by defining the MAILTO
variable at the top of your
crontab file:
MAILTO=
your_email_addressWindows XPUnder Windows XP, you can add a scheduled task by selecting Scheduled Tasks by opening
the Windows Control Panel, selecting the Performance and Maintenance”
entry, and choosing Scheduled Tasks. If you have Classic View enabled, you can choose
Scheduled Tasks directly from the Windows Control Panel.
Select Add Scheduled Task,
browse to the MySQL
bin directory,
and select mysqldump.exe. Select how frequently you want to run this program at the end of the configuration process, select the checkbox for Open advanced properties for this task when I click Finish and then click the Finish button. In the Run tab, type in the full command below. When prompted
to specify your password, enter your Windows password. Note that scheduled tasks don’t run if you don’t have a password set for your Windows account:
"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe" \
--user=root \
--password=
the_mysql_root_password \
--result-file=
C:\outputfile.sql \
database_nameUnder Windows Vista, take the following steps. Open the Windows Control Panel,
and select the
System and Maintenance entry, and then select the Administrative
Tools. If you have Classic View enabled, choose Administrative
Tools directly from theControl Panel. From the Administrative Tools, choose the Task Scheduler entry. Windows may prompt you for authorization—click Continue.
From the Task Schedule window, choose the Create Task entry from the Actions menu on the right. A dialog box will open with several tabs at the top. On the first tab (General, enter a name for the new task—for example, “MySQL daily dumps.”
Share with your friends: