Some want to run database operations at a specified time. If these operations are performed on the WEB Front-end, server resources will be wasted, because the WEB page needs to be refreshed continuously and then determined.
Some want to run database operations at a specified time. If these operations are performed on the WEB Front-end, server resources will be wasted, because the WEB page needs to be refreshed continuously and then determined.
Some want to run database operations at a specified time. If these operations are performed on the WEB Front-end, server resources will be wasted ,, because the web page needs to be refreshed constantly and then determined to execute the operation...
I used this method.
1. Create a directory crond. my in/etc
2. edit/etc/crontab
Minute hour day month week root run-parts/etc/cron. my
3. Create delete_table_msg.sh in cron. my.
The content is as follows:
/Usr/local/MySQL/bin/MySQL-hlocalhost-uroot-pwowangle </etc/cron.12/job. SQL
Why is the absolute path of MySQL required above? Because my MySQL is compiled by myself, and this MySQL command does not exist in the crontab PATH.
Please take a look at the PATH of the/etc/crontab file!
Sometimes, if the scheduled script is not run, check whether your command is in the path!
The job. SQL is the SQL statement to be executed.
! (Digress)
You need to know more about SQL! To complete more tasks! So SQL is very important! This is especially true for WEB developers. I don't believe what kind of excellent WEB programmers can use DW, if you just want a simple select * from table statement like this, you and I should have a hard time waking up!
My A. SQL contains the following content:
use xfcz;
delete from t;
Let's look at these two simple statements, because the data in the T table must be cleared at a fixed time every day.
Let's use your imagination. The most important thing is in this SQL ......