|
|
 |
|
 |
|
Anonymous Wrote:
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.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql
|
|
 |
|
 |
 |
|
 |
|
On Fri, 27 Jan 2012 13:17:52 +0100, walter harms <...@bfs.de
Am 26.01.2012 18:45, schrieb HalXsz SXndor:
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
|
|
 |
|
 |
 |
|
 |
|
On Tue, 6 Mar 2012 17:50:28 +0200, a bv <...@gmail.com
I found some scripts but i have to edit them to give the true table
name to drop. Its format is
name1_name2_yearmonth which year and month here we are talking
about is the year and date before the current day . So how can i give
this variable to the script?
Regards
2012/1/27 walter harms <...@bfs.de
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql
|
|
 |
|
 |
 |
|
 |
|
On Fri, 27 Jan 2012 12:08:51 +0100 (CET), Johan De Meersman <...@tuxera.be
----- Original Message -----
I agree with the assessment, but I take issue with this whole "do it in PHP/Python/language-of-the-month".
Why would I want to install PHP, Python or whatever on a database server? The art of Bash programming is far from dead, and it behooves any decent administrator to have at least some basic knowledge. Bash is literally on almost every system you're likely to run MySQL on, and it's capabilities probably far exceed what you think it can do.
--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql
|
|
 |
|
 |
 |
|
 |
|
On Fri, 27 Jan 2012 03:31:16 -0800, Karen Abgarian <...@apple.com
The original problem is traditionally resolved by partitioning the tables by historical range and creating a database job/event to drop older partitions and add the new ones. Depending on the environment, some might prefer shell scripts to do essentially the same.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql
|
|
 |
|
 |
|
|