Am 26.01.2012 18:45, schrieb HalXsz SXndor:
>>>>> 20120126 10:34 AM +0200, a bv >>>>
> Database contains
> tables (structures?) which gets montly data , and these tables are
> named as
> 
> name1_name2_ yearmonth . I only want to have the whole database system
> for last 2 years, and automaticly clean the data which became more
> than 2 years old , so i need a script for this (shell, php etc) . Can
> you please help me for this script ? and also which mysql command must
> be used drop, trunk? 
> <<<<<<<<
> You can, if you are careful, write an SQL procedure for dropping the 
> appropriate tables. Since MySQL has no table variables, if you do this you 
> will need PREPARE.
> 
> Therefore, it well may be easier to do it all in PHP, since therewith you can 
> construct statements. The statement "SHOW TABLES" is also a reference to 
> table INFORMATION_SCHEMA.TABLES; maybe you can use "SHOW TABLES" for a SELECT 
> statement in PHP; if not, try INFORMATION_SCHEMA.TABLES for their names.
> 
> 

This is simple,
consult your manual about crontab.
and start a script like that:

#!/bin/bash

mysql -BAN database <<EOF

 place my great sql-statemant here ....
 If you need some additional informationen like $HOME
 you can use it also

EOF

If something goes wrong a mail will be send to the owner (details
see man 5 crontab)

re,
 wh

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to