14.7.2 Changing the Number or Size of InnoDB Redo Log Files 改变InnoDB Redo Log Files的数量和大小

14.7.2 Changing the Number or Size of InnoDB Redo Log Files 改变InnoDB Redo Log Files的数量和大小

改变 InnoDB redo log 文件的数量和大小在MySQL 5.6.7或者更早版本,执行下面步骤:

1.如果 innodb_fast_shutdown is set to 2, set innodb_fast_shutdown to 1: 
mysql> show variables like '%innodb_fast_shutdown%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+
1 row in set (0.00 sec)

mysql> SET GLOBAL innodb_fast_shutdown = 1;


2.在确保 innodb_fast_shutdown  不是设置为2后,停止MySQL 确保关闭没有错误

3.拷贝老的log 文件到一个安全的地方万一错误发生 在你关闭期间你需要它们来恢复表空间

4. 删除老的日志文件从log file 目录

5.编辑my.cnf来改变log file 配置

6.再次启动mysql,mysqld 看到没有InnoDB log文件存在在启动时 会创建新的


在MySQL 5.6.8种, innodb_fast_shutdown 设置是不先关了当改变InnoDB log files的数量或者大小时。

此外, 你也不需要移除老的日志文件,尽管你仍旧需要copy 来的日志文件到一个安全的地方,作为备份。

改变InnoDB log files的大小和数量,执行下面的步骤:

1.停止MySQL server 确保他关闭没有错误

2.编辑my.cnf 改变log file配置。改变log file大小,配置 innodb_log_file_size.

增加log files的数量,配置innodb_log_files_in_group. 

3.再次启动MySQL

原文地址:https://www.cnblogs.com/hzcya1995/p/13350062.html