本篇文章为大家展示了MYSQL中怎么调整日志组,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

1、查看关闭方式:

mysql> show variables like '%fast%';

+----------------------+-------+

| Variable_name | Value |

+----------------------+-------+

| innodb_fast_shutdown | 1 |

+----------------------+-------+

1 row in set (0.00 sec)

该参数解释如下:,默认值为1,设置为0 是干净的关闭 和ORACLE里面shutdown immeidate对应

TheInnoDBshutdownmode. If the value is 0,InnoDBdoes aslow shutdown, a fullpurgeand a change buffer merge before shutting down. If the value is 1 (the default),InnoDBskips these operations at shutdown, a process known as afast shutdown. If the value is 2,InnoDBflushes its logs and shuts down cold, as if MySQL had crashed; no committed transactions are lost, but thecrash recoveryoperation makes the next startup take longer.。

2、调整参数innodb_fast_shutdown为0

set global innodb_fast_shutdown=0

3、关闭MYSQL

mysqladmin-urootshutdown-S/home/mysql-5.6/mysql-3306/mysql.sock

4、调整REDO大小,日志文件默认命名是ib_logfile开头

1、找到REDO文件所在目录(有几个文件处理几个,移动到其他目录)。

mv ib_logfilexx ../ ib_logfilexx

2、添加参数:日志组个数和日志大小到参数文件

在参数文件[mysqld]下面添加如下参数
innodb_log_file_size = 512M –每个日志组大小512M

innodb_log_files_in_group = 3—一共3组日志组

5、打开mysql

./mysqld_safe --defaults-file=/home/mysql-5.6/mysql-3307/my.cnf &

6、查看修改后的日志组大小和个数

mysql> show variables like '%log_file%';

+---------------------------+------------------------------------------------+

| Variable_name | Value |

+---------------------------+------------------------------------------------+

| general_log_file | /home/mysql-5.6/mysql-3306/data/test1.log |

| innodb_log_file_size | 536870912 |

| innodb_log_files_in_group | 3 |

| slow_query_log_file | /home/mysql-5.6/mysql-3306/data/test1-slow.log |

+---------------------------+------------------------------------------------+

4 rows in set (0.00 sec)

上述内容就是MYSQL中怎么调整日志组,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。