加入收藏 | 设为首页 | 会员中心 | 我要投稿 湘西站长网 (https://www.0743zz.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > 搜索优化 > 正文

MYSQL中怎么调整日志组

发布时间:2022-02-11 13:57:06 所属栏目:搜索优化 来源:互联网
导读:本篇文章为大家展示了MYSQL中怎么调整日志组,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。 1、查看关闭方式: mysql show variables like %fast%; +----------------------+-------+ | Variable_name | Value
      本篇文章为大家展示了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中怎么调整日志组,你们学到知识或技能了吗?

(编辑:湘西站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读