MYSQL中怎么调整日志组

48次阅读
没有评论

共计 1728 个字符,预计需要花费 5 分钟才能阅读完成。

自动写代码机器人,免费开通

本篇文章为大家展示了 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 中怎么调整日志组,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注丸趣 TV 行业资讯频道。

向 AI 问一下细节

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-12-04发表,共计1728字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)