我刚刚将我的 Wordpress 数据库切换为使用 InnoDB 引擎。
使用 MyISAM 时,我曾经运行Optimize和Repair table. 但是,对于 InnoDB,这些不起作用。
我手动运行OPTIMIZE TABLE并建议ALTER TABLE但没有一个删除开销。我在mysqltuner显示 14 个碎片表的服务器上运行- 我总共有 14 个表。即使在运行optimizeand 之后alter tables,所有 14 个表仍然碎片化!
我怎样才能正确地OPTIMIZE和REPAIRInnoDB 表?
由于以下问题:
mysql> desc reportingdb.v3_zone_date_cpm7k;
ERROR 1146 (42S02): Table 'reportingdb.v3_zone_date_cpm7k' doesn't exist
Run Code Online (Sandbox Code Playgroud)
/var/log/mysqld.log
120927 16:57:04 [ERROR] Cannot find or open table reportingdb/v3_zone_date_cpm7k#P#pcurrent_2012926 from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't …Run Code Online (Sandbox Code Playgroud) 我正在使用 innodb_file_per_table 运行 MySql innodb。
作为日常脚本,我想为一组表创建一个新分区,并删除昨天的分区。需要运行什么命令来删除旧分区以释放磁盘空间?我希望避免系统因数据库磁盘使用而耗尽磁盘空间。我还想避免关闭 Mysql。
编辑:我读过丢弃表空间应该删除占用大部分空间的 .ibd 文件。
ALTER TABLE tbl_name DISCARD TABLESPACE;
Run Code Online (Sandbox Code Playgroud)
但是,在分区表上使用此命令存在一个已知错误。
我已经安装了一个带有 InnoDB 的 MySQL 集群(随后启用了 innodb_file_per_table),但是由于我切换到 innodb_file_per_table,文件 ibdata1 增长(每月 2GB)。
my.cnf文件是否正确?服务器配置:
Debian 6 amd64
mysql-client-5.1 5.1.61-0+squeeze1
我的 InnoDB 配置文件:
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
innodb_file_per_table
innodb_buffer_pool_size = 5G
innodb_additional_mem_pool_size = 48M
innodb_log_files_in_group = 3
innodb_log_file_size = 512M …Run Code Online (Sandbox Code Playgroud) 我想将一些(不是全部)MyISAM 表转换为 InnoDB。
最好的配置是什么?(需要添加InnoDB设置,因为我的里面没有InnoDB设置my.cnf)。