mysql> help flush; Name: 'FLUSH' Description: Syntax: FLUSH [NO_WRITE_TO_BINLOG | LOCAL] flush_option [, flush_option] ... ………… The RESET statement is similar to FLUSH. See [HELP RESET], for information about using the RESET statement with replication.
BINARY closes and reopens the binary log files. ENGINE closes and reopens any flushable logs for installed storage engines. Currently, this causes InnoDB to flush its logs to disk and perform a checkpoint. ERROR closes and reopens the error log file. GENERAL closes and reopens the general query log file. RELAY closes and reopens the relay log files. SLOW closes and reopens the slow query log file. The log_type options were added in MySQL 5.5.3. 关于flush其他方面的用法,我不想直接翻译了,直接拿个网上别人现成的吧,如下:
[root@localhost logs]# ll total 32 -rw-rw---- 1 mysql mysql 1 Mar 12 14:28 mysql.err -rw-rw---- 1 mysql mysql 6 Mar 5 15:44 mysql.pid -rw-rw---- 1 mysql mysql 1015 Mar 12 15:32 query_log.log -rw-rw---- 1 mysql mysql 704 Mar 5 15:44 slow.log [root@localhost logs]# mv query_log.log query_log.log.1 登陆mysql命令界面下,执行如下操作:
[root@localhost logs]# ll total 40 -rw-rw---- 1 mysql mysql 1 Mar 12 14:28 mysql.err -rw-rw---- 1 mysql mysql 6 Mar 5 15:44 mysql.pid -rw-rw---- 1 mysql mysql 176 Mar 12 15:38 query_log.log -rw-rw---- 1 mysql mysql 1285 Mar 12 15:38 query_log.log.1 -rw-rw---- 1 mysql mysql 704 Mar 5 15:44 slow.log [root@localhost logs]# cat query_log.log /usr/local/mysql/bin/mysqld, Version: 5.5.21-log (Source distribution). started with: Tcp port: 3306 Unix socket: /tmp/mysqld.sock Time Id Command Argument 关于使用轮询脚本时的注意点:
/data/mysql/mysqld.log { # create 600 mysql mysql notifempty daily rotate 3 missingok compress postrotate # just if mysqld is really running if test -x /usr/local/mysql/bin/mysqladmin && /usr/local/mysql/bin/mysqladmin ping &>/dev/null then /usr/local/mysql/bin/mysqladmin flush-logs fi endscript } 上面脚本中的二处在设置密码后进运行时会报错的,因为其要使用密码的直持,具体为: