Innodb每个表空间一个文件

我正在走进一个使用MySQL和Innodb作为存储引擎的环境。 我想启用innodb_file_per_table来提高性能。 考虑到所有的数据库/表目前存储在ibdata1 /默认ibdata文件将innodb_file_per_table选项只影响新的表创build后,我设置此指令?

采取现有的数据库并将每个表分成它自己的ibd文件的最好方法是什么? 我将不得不转储/恢复所有的表,使这种情况发生?

http://dev.mysql.com/doc/refman/5.0/en/innodb-multiple-tablespaces.html

The --innodb_file_per_table option affects only table creation, not access to existing tables. If you start the server with this option, new tables are created using .ibd files, but you can still access tables that exist in the shared tablespace. If you start the server without this option, new tables are created in the shared tablespace, but you can still access any tables that were created using multiple tablespaces. 

是的,需要转储和恢复将现有的表格移动到他们自己的文件中。

我同意@ faker的回答和评论(他的回答为+1),但还有一件重要的事情要做:

在你closuresmysql之前,你需要运行SET GLOBAL innodb_fast_shutdown = 0; 。 为什么?

这将完全清除ib_logfile0和ib_logfile1中遗留的所有事务信息。 关机时间较长,但没有任何交易数据,没有与stream连忘返。 因此,在这个过程中不会有数据丢失。

这里是我在StackOverflow的文章如何做到这一点: https : //stackoverflow.com/a/4056261/491757