1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | mysql> SHOW GLOBAL VARIABLES LIKE '%log%'; +-----------------------------------------+-----------------------------------+ | Variable_name | Value | +-----------------------------------------+-----------------------------------+ | back_log | 50 | | binlog_cache_size | 32768 | | binlog_direct_non_transactional_updates | OFF | | binlog_format | MIXED | | binlog_stmt_cache_size | 32768 | | expire_logs_days | 0 | | general_log | OFF | | general_log_file | /mydata/data/stu18.log | | innodb_flush_log_at_trx_commit | 1 | | innodb_locks_unsafe_for_binlog | OFF | | innodb_log_buffer_size | 8388608 | | innodb_log_file_size | 5242880 | | innodb_log_files_in_group | 2 | | innodb_log_group_home_dir | ./ | | innodb_mirrored_log_groups | 1 | | log | OFF | | log_bin | ON | | log_bin_trust_function_creators | OFF | | log_error | /mydata/data/stu18.magedu.com.err |定义错误日志 | log_output | FILE | | log_queries_not_using_indexes | OFF | | log_slave_updates | OFF | | log_slow_queries | OFF | | log_warnings | 1 是否把警告信息写入错误日志中 | max_binlog_cache_size | 18446744073709547520 | | max_binlog_size | 1073741824 | | max_binlog_stmt_cache_size | 18446744073709547520 | | max_relay_log_size | 0 | | relay_log | | | relay_log_index | | | relay_log_info_file | relay-log.info | | relay_log_purge | ON | | relay_log_recovery | OFF | | relay_log_space_limit | 0 | | slow_query_log | OFF | | slow_query_log_file | /mydata/data/stu18-slow.log | | sql_log_bin | ON | | sql_log_off | OFF | | sync_binlog | 0 | | sync_relay_log | 0 | | sync_relay_log_info | 0 | +-----------------------------------------+-----------------------------------+ |
1 2 3 | [root@stu18 data]# vim /etc/my.cnf [mysqld] Log_error=DIR/[filename] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | [root@stu18 data]# tail -20 stu18.magedu.com.err 130813 15:30:50 InnoDB: Starting shutdown... 130813 15:30:51 InnoDB: Shutdown completed; log sequence number 1630920 130813 15:30:51 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete 130813 15:30:52 mysqld_safe mysqld from pid file /mydata/data/stu18.magedu.com.pid ended 130813 15:30:53 mysqld_safe Starting mysqld daemon with databases from /mydata/data 130813 15:30:54 InnoDB: The InnoDB memory heap is disabled #禁用了InnoDB memory的堆功能。 130813 15:30:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins #Mutexes(互斥量)和rw_locks(行级锁)是GCC编译的是InnoDB内置的。 130813 15:30:54 InnoDB: Compressed tables use zlib 1.2.3 #默认压缩工具是zlib 130813 15:30:55 InnoDB: Initializing buffer pool, size = 128.0M #InnoDB引擎的缓冲池(buffer pool)的值大小 130813 15:30:55 InnoDB: Completed initialization of buffer pool 130813 15:30:55 InnoDB: highest supported file format is Barracuda. 130813 15:30:57 InnoDB: Waiting for the background threads to start 130813 15:30:58 InnoDB: 5.5.33 started; log sequence number 1630920 130813 15:30:58 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 130813 15:30:58 [Note] - '0.0.0.0' resolves to '0.0.0.0'; #0.0.0.0会反解主机名,这里反解失败 130813 15:30:58 [Note] Server socket created on IP: '0.0.0.0'. 130813 15:30:58 [Note] Event Scheduler: Loaded 0 events #事件调度器没有任何事件,因为没有装载。 130813 15:30:58 [Note] /usr/local/mysql/bin/mysqld: ready for connections. #mysql启动完成等待客户端的请求。 Version: '5.5.33-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution #创建一个本地sock用于本地连接。 |
1 2 3 4 | [root@stu18 data]# mv stu18.magedu.com.err stu18.magedu.com.err.old [root@stu18 data]# mysqladmin flush-logs [root@stu18 data]# ls hellodb myclass mysql-bin.000003 mysql-bin.index stu18.magedu.com.pid ibdata1 mysql mysql-bin.000004 performance_schema ib_logfile0 mysql-bin.000001 stu18.magedu.com.err test ib_logfile1 mysql-bin.000002 stu18.magedu.com.err.old |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | mysql> SHOW GLOBAL VARIABLES LIKE '%log%'; +-----------------------------------------+-----------------------------------+ | Variable_name | Value | +-----------------------------------------+-----------------------------------+ | back_log | 50 | | binlog_cache_size | 32768 | | binlog_direct_non_transactional_updates | OFF | | binlog_format | MIXED | | binlog_stmt_cache_size | 32768 | | expire_logs_days | 0 | | general_log | OFF #定义查询日志是否开启 | | general_log_file | /mydata/data/stu18.log #定义查询日志的文件地址名称 | | innodb_flush_log_at_trx_commit | 1 | | innodb_locks_unsafe_for_binlog | OFF | | innodb_log_buffer_size | 8388608 | | innodb_log_file_size | 5242880 | | innodb_log_files_in_group | 2 | | innodb_log_group_home_dir | ./ | | innodb_mirrored_log_groups | 1 | | log | OFF #是否开启日志 (若开启则表示开启所有的日志功能) | | log_bin | ON | | log_bin_trust_function_creators | OFF | | log_error | /mydata/data/stu18.magedu.com.err | | log_output | FILE #日志的输出的位置 | | log_queries_not_using_indexes | OFF | | log_slave_updates | OFF | | log_slow_queries | OFF | | log_warnings | 1 | | max_binlog_cache_size | 18446744073709547520 | | max_binlog_size | 1073741824 | | max_binlog_stmt_cache_size | 18446744073709547520 | | max_relay_log_size | 0 | | relay_log | | | relay_log_index | | | relay_log_info_file | relay-log.info | | relay_log_purge | ON | | relay_log_recovery | OFF | | relay_log_space_limit | 0 | | slow_query_log | OFF | | slow_query_log_file | /mydata/data/stu18-slow.log | | sql_log_bin | ON | | sql_log_off | OFF | | sync_binlog | 0 | | sync_relay_log | 0 | | sync_relay_log_info | 0 | +-----------------------------------------+-----------------------------------+ 41 rows in set (0.00 sec) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | mysql> use mysql; #在此数据库中 Database changed mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | #这个就是查询日志的表输出位置 | help_category | | help_keyword | | help_relation | | help_topic ……………… | +---------------------------+ |
1 2 3 | mysql> SHOW GLOBAL VARIABLES LIKE '%log%'; | slow_query_log | OFF #定义慢查询日志的 | slow_query_log_file |/mydata/data/stu18-slow.log #输出方式为file(文件)时定义慢查询日志的位置 |
1 2 3 4 | [root@stu18 data]# vim /etc/my.cnf [mysqld] slow_query_log=1 log-slow-queries [= DIR/[filename] ] |
1 2 3 4 5 6 7 | mysql> SHOW GLOBAL VARIABLES LIKE 'long%'; +-----------------+-----------+ | Variable_name | Value | +-----------------+-----------+ | long_query_time | 10.000000 | +-----------------+-----------+ 1 row in set (0.04 sec) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | mysql> set globalslow_query_log=1; #开启慢查询日志 Query OK, 0 rowsaffected (0.35 sec) mysql> setsession long_query_time=0.001; #更改时间(当前session中,退出则重置) Query OK, 0 rowsaffected (0.00 sec) mysql> set globallong_query_time=0.001; #更改时间(全局中,重启服务则重置) mysql> SHOWVARIABLES LIKE 'long%'; #查询定义时间 +-----------------+----------+ | Variable_name | Value | +-----------------+----------+ | long_query_time |0.001000 | +-----------------+----------+ 1 row in set (0.00sec) mysql> showglobal variables like "%slow%"; #查看慢查询日志开启状态 +---------------------+-----------------------------+ | Variable_name | Value | +---------------------+-----------------------------+ |log_slow_queries | ON | |slow_launch_time | 2 | |slow_query_log | ON | |slow_query_log_file | /mydata/data/stu18-slow.log | +---------------------+-----------------------------+ 4 rows in set (0.03sec) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | mysql> use mysql mysql> selectuser,host,password from user where user="root"; +------+------------------+----------+ | user | host | password | +------+------------------+----------+ | root |localhost | | | root |stu18.magedu.com | | | root |127.0.0.1 | | | root | ::1 | | +------+------------------+----------+ 4 rows in set (0.08sec) #查询时间为0.08 mysql> systemmore /mydata/data/stu18_slow.log #查询慢查询日志记录信息 /usr/local/mysql/bin/mysqld,Version: 5.5.33-log (Source distribution). started with: Tcp port: 3306 Unix socket: /tmp/mysql.sock Time Id Command Argument >>>>>>>>>>>>>>>>部分已省略>>>>>>>>>>>>>> # Time: 13100723:46:33 # User@Host:root[root] @ localhost [] # Query_time:0.108459 Lock_time: 0.000216 Rows_sent:4 Rows_examined: 6 SETtimestamp=1381160793; selectuser,host,password from user where user="root"; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | mysql> SHOWGLOBAL VARIABLES LIKE '%log%'; +-----------------------------------------+-----------------------------------+ | Variable_name | Value | +-----------------------------------------+-----------------------------------+ | innodb_flush_log_at_trx_commit | 1 #在事务提交时innodb是否同步日志从缓冲到文件中1表示事务以提交就同步不提交每隔一秒同步一次,性能会很差造成大量的磁盘I/O;定义为2表示只有在事务提交时才会同步但是可能会丢失整个事务 | |innodb_locks_unsafe_for_binlog |OFF | | innodb_log_buffer_size | 8388608 | |innodb_log_file_size |5242880 | | innodb_log_files_in_group | 2 #至少有两个 | |innodb_log_group_home_dir |./ #定义innodb事务日志组的位置 | |innodb_mirrored_log_groups |1 #表示对日志组做镜像 | 每个事务日志都是大小为5兆的文件: [root@stu18 data]#ls -lh -rw-rw---- 1 mysqlmysql 5.0M Oct 7 23:36 ib_logfile0 -rw-rw---- 1 mysqlmysql 5.0M Aug 12 01:06 ib_logfile1 |
1 2 3 4 5 6 7 8 | mysql> showglobal variables like "%log_bin%"; +---------------------------------+-------+ | Variable_name | Value | +---------------------------------+-------+ | log_bin | ON | #已开启 |log_bin_trust_function_creators | OFF | | sql_log_bin | ON | +---------------------------------+-------+ |
1 2 3 4 5 6 7 8 9 10 | mysql> showglobal variables like "%log%"; sql_log_bin ={ON|OFF} #用于控制会话级别二进制日志功能的开启或关闭。默认为ON,表示启用记录功能。用户可以在会话级别修改此变量的值,但其必须具有SUPER权限。 binlog_cache_size =32768 #默认值32768 Binlog Cache用于在打开了二进制日志(binlog)记录功能的环境,是MySQL 用来提高binlog的记录效率而设计的一个用于短时间内临时缓存binlog数据的内存区域。一般来说,如果我们的数据库中没有什么大事务,写入也不是特别频繁,2MB~4MB是一个合适的选择。但是如果我们的数据库大事务较多,写入量比较大,可与适当调高binlog_cache_size。同时,我们可以通过binlog_cache_use 以及 binlog_cache_disk_use来分析设置的binlog_cache_size是否足够,是否有大量的binlog_cache由于内存大小不够而使用临时文件(binlog_cache_disk_use)来缓存了。 binlog_stmt_cache_size= 32768 #当非事务语句使用二进制日志缓存,但是超出binlog_stmt_cache_size时,使用一个临时文件来存放这些语句。 log_bin = mysql-bin#指定binlog的位置,默认在数据目录下。 binlog-format= {ROW|STATEMENT|MIXED} #指定二进制日志的类型,默认为MIXED。如果设定了二进制日志的格式,却没有启用二进制日志,则MySQL启动时会产生警告日志信息并记录于错误日志中。 sync_binlog = 10#设定多久同步一次二进制日志至磁盘文件中,0表示不同步,任何正数值都表示对二进制每多少次写操作之后同步一次。当autocommit的值为1时,每条语句的执行都会引起二进制日志同步,否则,每个事务的提交会引起二进制日志同步 max_binlog_cache_size= {4096 .. 18446744073709547520} #二进定日志缓存空间大小,5.5.9及以后的版本仅应用于事务缓存,其上限由max_binlog_stmt_cache_size决定。 max_binlog_stmt_cache_size= {4096 .. 18446744073709547520} #二进定日志缓存空间大小,5.5.9及以后的版本仅应用于事务缓存 expire_log_days ={0..99} #设定二进制日志的过期天数,超出此天数的二进制日志文件将被自动删除。默认为0,表示不启用过期自动删除功能。如果启用此功能,自动删除工作通常发生在MySQL启动时或FLUSH日志时。 |
1 2 3 | [root@stu18 ~]#my.cnf [mysqld] log-bin [=DIR / [filename]] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [root@stu18 ~]# cd /mydata/data/ [root@stu18 data]#ls -lh -rw-rw---- 1 mysqlmysql 14K Aug 13 15:30 mysql-bin.000001 -rw-rw---- 1 mysqlmysql 150 Aug 13 17:05 mysql-bin.000002 -rw-rw---- 1 mysqlmysql 150 Aug 13 17:06 mysql-bin.000003 -rw-rw---- 1 mysqlmysql 150 Aug 13 17:07 mysql-bin.000004 -rw-rw---- 1 mysqlmysql 150 Aug 13 17:39 mysql-bin.000005 -rw-rw---- 1 mysqlmysql 126 Aug 13 19:03 mysql-bin.000006 -rw-rw---- 1 mysqlmysql 126 Aug 13 19:03 mysql-bin.000007 -rw-rw---- 1 mysqlmysql 126 Aug 13 19:05 mysql-bin.000008 -rw-rw---- 1 mysqlmysql 107 Aug 13 19:05 mysql-bin.000009 -rw-rw---- 1 mysqlmysql 353 Oct 7 23:40 mysql-bin.000010 -rw-rw---- 1 mysqlmysql 190 Oct 7 20:43 mysql-bin.index [root@stu18 data]#cat mysql-bin.index ./mysql-bin.000001 ./mysql-bin.000002 ./mysql-bin.000003 ./mysql-bin.000004 ./mysql-bin.000005 ./mysql-bin.000006 ./mysql-bin.000007 ./mysql-bin.000008 ./mysql-bin.000009 ./mysql-bin.000010 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | mysql> showbinary logs; #显示当前服务器使用的二进制文件及大小 +------------------+-----------+ | Log_name | File_size | +------------------+-----------+ | mysql-bin.000001| 13814 | | mysql-bin.000002| 150 | | mysql-bin.000003| 150 | | mysql-bin.000004| 150 | | mysql-bin.000005| 150 | | mysql-bin.000006| 126 | | mysql-bin.000007| 126 | | mysql-bin.000008| 126 | | mysql-bin.000009| 107 | | mysql-bin.000010| 353 | +------------------+-----------+ 10 rows in set (0.07sec) mysql> showmaster logs; #显示主服务器使用的二进制文件及大小 +------------------+-----------+ | Log_name | File_size | +------------------+-----------+ | mysql-bin.000001| 13814 | | mysql-bin.000002| 150 | | mysql-bin.000003| 150 | | mysql-bin.000004| 150 | | mysql-bin.000005| 150 | | mysql-bin.000006| 126 | | mysql-bin.000007| 126 | | mysql-bin.000008| 126 | | mysql-bin.000009| 107 | | mysql-bin.000010| 353 | +------------------+-----------+ 10 rows in set (0.02sec) mysql> showmaster status; #当前使用的二进制文件及所处位置 +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB |Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000010| 353 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.00sec) |
1 2 3 4 5 6 7 8 9 10 | mysql> flushlogs; Query OK, 0 rowsaffected (0.23 sec) 注意:flush logs一般只会滚动中继日志和二进制日志。 mysql> showmaster status; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB |Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000011| 107 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.00sec) |
1 2 3 4 5 6 7 8 9 10 11 12 13 | mysql> createdatabase yong; Query OK, 1 rowaffected (0.12 sec) mysql> createtable yong.tb1 (id int,name char(20)); Query OK, 0 rowsaffected (0.44 sec) mysql> insertinto yong.tb1 values(1,'tom'); Query OK, 1 rowaffected (0.14 sec) mysql> showmaster status; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB |Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000011| 479 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.00sec) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | SHOW BINLOG EVENTS[IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count] mysql> showbinlog events/G #查看所有的二进制信息 ***************************87. row *************************** Log_name: mysql-bin.000001 Pos: 13580 Event_type: Query Server_id: 1 End_log_pos: 13688 Info: use `hellodb`; /*!40000 ALTERTABLE `toc` DISABLE KEYS */ ***************************88. row *************************** Log_name: mysql-bin.000001 Pos: 13688 Event_type: Query Server_id: 1 End_log_pos: 13795 Info: use `hellodb`; /*!40000 ALTERTABLE `toc` ENABLE KEYS */ ***************************89. row *************************** Log_name: mysql-bin.000001 Pos: 13795 Event_type: Stop Server_id: 1 End_log_pos: 13814 Info: 89 rows in set (0.00sec) mysql> showbinlog events in 'mysql-bin.000011'; #查看指定日志的二进制信息 +------------------+-----+-------------+-----------+-------------+----------------------------------------------+ | Log_name | Pos | Event_type | Server_id | End_log_pos | Info | +------------------+-----+-------------+-----------+-------------+----------------------------------------------+ | mysql-bin.000011| 4 | Format_desc | 1 | 107 | Server ver: 5.5.33-log, Binlogver: 4 | | mysql-bin.000011 |107 | Query | 1 | 190 | create database yong | | mysql-bin.000011 |190 | Query | 1 | 293 | create table yong.tb1 (idint,name char(20)) | | mysql-bin.000011 |293 | Query | 1 | 357 | BEGIN | | mysql-bin.000011 |357 | Query | 1 | 452 | insert into yong.tb1values(1,'tom') | | mysql-bin.000011 |452 | Xid | 1 | 479 | COMMIT /* xid=103 */ | +------------------+-----+-------------+-----------+-------------+----------------------------------------------+ 6 rows in set (0.00sec) mysql> showbinlog events in 'mysql-bin.000011' from 190; #从指定的事件位置开始 +------------------+-----+------------+-----------+-------------+----------------------------------------------+ | Log_name | Pos | Event_type | Server_id |End_log_pos | Info | +------------------+-----+------------+-----------+-------------+----------------------------------------------+ | mysql-bin.000011 |190 | Query | 1 | 293 | create table yong.tb1 (idint,name char(20)) | | mysql-bin.000011 |293 | Query | 1 | 357 | BEGIN | | mysql-bin.000011 |357 | Query | 1 | 452 | insert into yong.tb1values(1,'tom') | | mysql-bin.000011 |452 | Xid | 1 | 479 | COMMIT /* xid=103 */ | +------------------+-----+------------+-----------+-------------+----------------------------------------------+ 4 rows in set (0.00sec) mysql> showbinlog events in 'mysql-bin.000011' from 190 limit 3; #指定偏移量(不是语句,是事件) +------------------+-----+------------+-----------+-------------+----------------------------------------------+ | Log_name | Pos | Event_type | Server_id |End_log_pos | Info | +------------------+-----+------------+-----------+-------------+----------------------------------------------+ | mysql-bin.000011 |190 | Query | 1 | 293 | create table yong.tb1 (idint,name char(20)) | | mysql-bin.000011 |293 | Query | 1 | 357 | BEGIN | | mysql-bin.000011 |357 | Query | 1 | 452 | insert into yong.tb1values(1,'tom') | +------------------+-----+------------+-----------+-------------+----------------------------------------------+ 3 rows in set (0.00sec) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [root@stu18 data]#mysqlbinlog mysql-bin.000017 #必须在数据目录下 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET@@session.max_insert_delayed_threads=0*/; /*!50003 SET@OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 #事件开始处 #131009 0:25:59 server id 1 end_log_pos 107 Start: binlog v 4, server v 5.5.33-log created 131009 0:25:59 # Warning: thisbinlog is either in use or was not closed properly. BINLOG ' FzJUUg8BAAAAZwAAAGsAAAABAAQANS41LjMzLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA== '/*!*/; # at 107 #131009 0:26:36 server id 1 end_log_pos 192 Query thread_id=12 exec_time=0 error_code=0 #131009 0:26:36年月日的简写方式;end_log_pos事件结束处;thread_id=12 哪个会话线程创建的此语句;exec_time=0 执行时长单位为秒;error_code=0 错误代码0表示没有 SET TIMESTAMP=1381249596/*!*/; #预设信息(环境设定) |
1 | [root@stu18 data]#mysqlbinlog mysql-bin.000017 > /tmp/a.sql |
1 | [root@stu18 data]#mysql < a.sql |
1 2 3 4 5 6 7 8 9 | mysql> resetmaster; Query OK, 0 rowsaffected (0.17 sec) mysql> showbinary logs; +------------------+-----------+ | Log_name | File_size | +------------------+-----------+ | mysql-bin.000001| 107 | +------------------+-----------+ 1 row in set (0.04sec) |
1 | mysql> PURGE { BINARY | MASTER } LOGS {TO 'log_name' | BEFORE datetime_expr } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | mysql> PURGEBINARY LOGS TO 'mysql-bin.000007'; Query OK, 0 rowsaffected (0.11 sec) mysql> showbinary logs; +------------------+-----------+ | Log_name | File_size | +------------------+-----------+ | mysql-bin.000007| 150 | | mysql-bin.000008| 150 | | mysql-bin.000009| 150 | | mysql-bin.000010| 150 | | mysql-bin.000011| 150 | | mysql-bin.000012| 150 | | mysql-bin.000013| 150 | | mysql-bin.000014| 150 | | mysql-bin.000015| 150 | | mysql-bin.000016| 150 | | mysql-bin.000017| 483 | +------------------+-----------+ 11 rows in set (0.04sec) [root@stu18 data]#cat mysql-bin.index ./mysql-bin.000007 ./mysql-bin.000008 ./mysql-bin.000009 ./mysql-bin.000010 ./mysql-bin.000011 ./mysql-bin.000012 ./mysql-bin.000013 ./mysql-bin.000014 ./mysql-bin.000015 ./mysql-bin.000016 ./mysql-bin.000017 |
1 2 | mysql> PURGEBINARY LOGS BEFORE '13-10-19 10:26:36'; #使用时间来删除二进制日志 Query OK, 0 rowsaffected (0.05 sec) |