|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
MySQL restore via Cron
Hope I am in the correct area here.
I am running a demo site of our PHP/MySQL backend. This is obviously open to abuse from people posting nonsense in the demo site. Apart from very basic use of cron I am a newbie. Any clues on a cron to run say once per hour to do a restore to a pre saved clean db. Thanks in advance |
|
#2
|
|||
|
|||
|
You could use the following to get you started;
Create a new crontab entry (crontab -e) and enter the following to run the command every hour: 0 * * * * mysql -u $user -p$pass yourdb < /path/to/dbbackup.sql (Where $user and $pass are substituted for the actual username and password for the database) This should import /path/to/dbbackup.sql into yourdb. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > MySQL restore via Cron |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|