MySQL Variables flush 数据库 参数变量解释及正确配置使用

本站中文解释

_logs

flush_logs参数是MySQL数据库的系统参数,作用是控制MySQL的日志文件自动刷新时间。当MySQL服务重启、发生错误或异常时,由于MySQL实施最大的InnoDB日志文件大小,会造成当前的事务日志滚动无法存储,这时就需要调用flush_logs参数进行调用事务日志滚动,以保证下次MySQL服务自动重启时优先检索最新的事务日志文件,以保证MySQL数据库的恢复。

flush_logs参数的默认设置可以在以下三个位置进行设置:

1) my.ini配置文件中
flush_logs=1

2) MySQL命令行客户端中
mysql> set global flush_logs=1;

3)启动MySQL服务器时
–flush_logs=1

官方英文解释

flush

Command-Line Format --flush[={OFF|ON}]
System Variable flush
Scope Global
Dynamic Yes
Type Boolean
Default Value OFF

If ON, the server flushes (synchronizes)
all changes to disk after each SQL statement. Normally, MySQL
does a write of all changes to disk only after each SQL
statement and lets the operating system handle the
synchronizing to disk. See Section B.3.3.3, “What to Do If MySQL Keeps Crashing”. This
variable is set to ON if you start
mysqld with the
--flush option.

Note

If flush is enabled, the
value of flush_time does
not matter and changes to
flush_time have no effect
on flush behavior.


数据运维技术 » MySQL Variables flush 数据库 参数变量解释及正确配置使用