PDA

View Full Version : Flush Tables question


mvigod
Wed 6th Feb '02, 8:49pm
Eva,

What is the best way to ensure your data is safe should the mysqld crash?

If the site is running say for 10 days and then the plug is pulled from the server and power is lost (worse case scenario) is all the data for the 10 days lost? Can you set the tables to flush manually at some interval so all data is written to disk and cannot be lost? Can this be done while running the server or does the board need to be shut down while flushing the tables?

I think when my server last crashed I lost some data so if I could flush the tables to disk or something every hour (by script or some config option in mysql) that would give me some peace of mind. What are my options?

Thanks...

eva2000
Thu 7th Feb '02, 12:54am
you won't loose 10 days of data if the plug was plugged... generally when the server comes back from being unplugged so to speak running mysql recovery methods on the database will recover and repair and corruption - you may loose a few records which were not written to disk

to flush tables you can run this while forums are open and of course you need mysql live to be able to run flush tables anyway

command to run:

mysqladmin -u root -p flush-tables

from root user in shell

jeffct
Sat 9th Feb '02, 1:15am
MySQL saves all of it's data to the hard drive, so if you pull the plug you are not going to lose all of your data, it's saved.

That is unless you use MySQL's HEAP tables, but I doubt you do.