MySQL does not automatically keep track of when each record was inserted into its databases. To do this, you will need to include a "date_posted" field in each record, and supply that information when the record is inserted into the database.
Once this is done, it is simple to remove all the old records:
Code:
delete from mytable where post_date < (curdate()-30)
Of course, you can improve on this by noting that not every month has 30 days, ...
To make this happen automatically, you can write a simple shell script that runs
mysql, which in turn will source a script containing your DB commands. Then, use the cron facilities to schedule this script to run at the interval you want.