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 } 上面腳本中的二處在設置密碼后進運行時會報錯的,因為其要使用密碼的直持,具體為: