温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

MYSQL中怎么调整日志组

发布时间:2021-07-24 16:52:54 来源:亿速云 阅读:140 作者:Leah 栏目: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中怎么调整日志组,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI