I've created some very large databases and have since dropped a few. I've noticed my disk space has not recovered as much as I had expected. For instance, the last database I added actually used up all of my free space and aborted, so I dropped that schema. Before this I had 12.4 GB free, now I only have 7.52 GB free.
What's going on here? How do I get my ~5 GB back?
我已经创建了一些非常大的数据库,并且已经删除了一些。我注意到我的磁盘空间没有像我预期的那样恢复。例如,我添加的最后一个数据库实际上耗尽了我所有的可用空间并中止了,所以我删除了该模式。在此之前,我有12.4 GB免费,现在我只有7.52 GB免费。这里发生了什么?我如何获得~5 GB的回复?
1 个解决方案
#1
23
From http://dev.mysql.com/doc/refman/5.1/en/innodb-data-log-reconfiguration.html:
来自http://dev.mysql.com/doc/refman/5.1/en/innodb-data-log-reconfiguration.html:
Currently, you cannot remove a data file from the tablespace. To decrease the size of your tablespace, use this procedure:
目前,您无法从表空间中删除数据文件。要减小表空间的大小,请使用以下过程:
Use mysqldump to dump all your InnoDB tables.
使用mysqldump转储所有InnoDB表。
Stop the server.
停止服务器。
Remove all the existing tablespace files, including the ibdata and ib_log files. If you want to keep a backup copy of the information, then copy all the ib* files to another location before the removing the files in your MySQL installation.
删除所有现有的表空间文件,包括ibdata和ib_log文件。如果要保留信息的备份副本,请在删除MySQL安装中的文件之前将所有ib *文件复制到另一个位置。
Remove any .frm files for InnoDB tables.
删除InnoDB表的任何.frm文件。
Configure a new tablespace.
配置新的表空间。
Restart the server.
重启服务器。
Import the dump files.
导入转储文件。
Innodb creates a filesystem (the "tablespace") within the data files themselves. It never "shrinks" the data files when data is removed, since the reorganization of the data within the file could be costly (there's no guarantee that the data removed was at the end, or even contiguous). By recreating the database as described above, it makes the file as large as necessary for all the data, but no larger.
Innodb在数据文件本身内创建一个文件系统(“表空间”)。当数据被删除时,它永远不会“缩小”数据文件,因为文件中数据的重组可能成本很高(不能保证删除的数据最后,甚至是连续的)。通过如上所述重新创建数据库,它使文件尽可能大到所有数据,但不大。
#1
23
From http://dev.mysql.com/doc/refman/5.1/en/innodb-data-log-reconfiguration.html:
来自http://dev.mysql.com/doc/refman/5.1/en/innodb-data-log-reconfiguration.html:
Currently, you cannot remove a data file from the tablespace. To decrease the size of your tablespace, use this procedure:
目前,您无法从表空间中删除数据文件。要减小表空间的大小,请使用以下过程:
Use mysqldump to dump all your InnoDB tables.
使用mysqldump转储所有InnoDB表。
Stop the server.
停止服务器。
Remove all the existing tablespace files, including the ibdata and ib_log files. If you want to keep a backup copy of the information, then copy all the ib* files to another location before the removing the files in your MySQL installation.
删除所有现有的表空间文件,包括ibdata和ib_log文件。如果要保留信息的备份副本,请在删除MySQL安装中的文件之前将所有ib *文件复制到另一个位置。
Remove any .frm files for InnoDB tables.
删除InnoDB表的任何.frm文件。
Configure a new tablespace.
配置新的表空间。
Restart the server.
重启服务器。
Import the dump files.
导入转储文件。
Innodb creates a filesystem (the "tablespace") within the data files themselves. It never "shrinks" the data files when data is removed, since the reorganization of the data within the file could be costly (there's no guarantee that the data removed was at the end, or even contiguous). By recreating the database as described above, it makes the file as large as necessary for all the data, but no larger.
Innodb在数据文件本身内创建一个文件系统(“表空间”)。当数据被删除时,它永远不会“缩小”数据文件,因为文件中数据的重组可能成本很高(不能保证删除的数据最后,甚至是连续的)。通过如上所述重新创建数据库,它使文件尽可能大到所有数据,但不大。