欢迎光临
我们一直在努力

MYSQL中怎么调整日志组

本篇文章为大家展示了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对应

The InnoDB shutdown mode. If the value is 0, InnoDB does a slow shutdown, a full purge and a change buffer merge before shutting down. If the value is 1 (the default), InnoDB skips these operations at shutdown, a process known as a fast shutdown. If the value is 2, InnoDB flushes its logs and shuts down cold, as if MySQL had crashed; no committed transactions are lost, but the crash recovery operation makes the next startup take longer.。

2、调整参数innodb_fast_shutdown为0

set global innodb_fast_shutdown=0

3、关闭MYSQL

       mysqladmin -uroot  shutdown -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中怎么调整日志组,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注云搜网行业资讯频道。

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。