mysql 中ibtmp1文件过大的问题

  • 问题描述

    生产环境linux suse11.4, 根目录/ 下大小:50G, ibtmp1大小:31G, 磁盘空间爆满100%告警。

  • ibtmp1文件说明 

    ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在支持大文件的系统这个文件大小是可以无限增长的。

  • 解决办法

    1、修改my.cnf配置文件:

      innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G

    2、设置innodb_fast_shutdown参数

      SET GLOBAL innodb_fast_shutdown = 0;  #InnoDB does a slow shutdown, a full purge and a change buffer merge before shutting down

    3、关闭mysql服务

    4、删除ibtmp1文件(重启自动删除)

    5、启动mysql服务

    注意:为了避免以后再出现类似的情况,一定要在限制临时表空间的最大值,如innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G

这样重启后会发现提示

我就删除了 ibtmp1 结果提示

If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!

删除ib_logfile的文件,就是说要移除就把ib* 的文件一起移除;再尝试启动mysql服务;

好了 

记得修改配置不要直接删除文件 直接mv 修改下文件 万一弄错了呢

发布了264 篇原创文章 · 获赞 46 · 访问量 37万+

猜你喜欢

转载自blog.csdn.net/qq_27229113/article/details/103118440