溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

MYSQL中怎么調(diào)整日志組

發(fā)布時間:2021-07-24 16:52:54 來源:億速云 閱讀:149 作者:Leah 欄目:MySQL數(shù)據(jù)庫

本篇文章為大家展示了MYSQL中怎么調(diào)整日志組,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。

1、查看關(guān)閉方式:

mysql> show variables like '%fast%';

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

| Variable_name        | Value |

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

| innodb_fast_shutdown | 1     |

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

1 row in set (0.00 sec)

該參數(shù)解釋如下:,默認(rèn)值為1,設(shè)置為0 是干凈的關(guān)閉 和ORACLE里面shutdown immeidate對應(yīng)

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、調(diào)整參數(shù)innodb_fast_shutdown為0

set global innodb_fast_shutdown=0

3、關(guān)閉MYSQL

       mysqladmin -uroot  shutdown -S /home/mysql-5.6/mysql-3306/mysql.sock

4、調(diào)整REDO大小,日志文件默認(rèn)命名是ib_logfile開頭

1、找到REDO文件所在目錄(有幾個文件處理幾個,移動到其他目錄)。

mv ib_logfilexx   ../ ib_logfilexx

2、添加參數(shù):日志組個數(shù)和日志大小到參數(shù)文件

在參數(shù)文件[mysqld]下面添加如下參數(shù)
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、查看修改后的日志組大小和個數(shù)

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)

上述內(nèi)容就是MYSQL中怎么調(diào)整日志組,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI