开发者

How to purge the Database data and log files in MySQL?

I want to purge the ibdata1, ib_logfile0 and ib_logfile1 files in MySQL. Because these files are tak开发者_JAVA技巧ing too much space of my C:\ disk. And I don't want to move these files anywhere else in the Hard disk. I heard about purging which can shrink the data. I am using Windows Vista. What are the steps to be done to purge the data ?


The log files can be removed anytime. Only the most recent log is kept open/locked. However, deleting id_data will trash all of your InnoDB databases - that's the actual data store.


As pointed out by MarcB, you can delete the (old) logfiles without problems; MySQL does not need them to run.

The data file ibdata* must not be deleted, it contains the actual database data.

I will grow as the database grows; unfortunately there is not way to shrink it, even if you later delete data from the database. The only way is to dump and reimport the whole database.

Also see this question: MySQL data file won't shrink

It explains various options to better cope with growing data files.


Short answer: There's no way to reduce the size of the ibdata files once they grew to a certain size. MySQL recommends dumping all innodb type data, shutting down mysql, deleting the ibdata files and restarting, then loading the data again. A one-click "compact" solution like other systems have is still missing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜