共計 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 問一下細節