我创建了一个数据库、一个表并插入了一些数据,并binlog.0000001
在我的日志文件夹中找到了这些数据,但是当我这样做时mysqlbinlog binlog.0000001
,它只显示下面的内容,似乎不完整:(日志目录中只有两个文件binlog.000001 binlog.index
:)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#120924 21:12:56 server id 1 end_log_pos 107 Start: binlog v 4, server v 5.5.24-0ubuntu0.12.04.1-log created 120924 21:12:56 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
BINLOG '
GAVhUA8BAAAAZwAAAGsAAAABAAQANS41LjI0LTB1YnVudHUwLjEyLjA0LjEtbG9nAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAYBWFQEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
'/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
如果该警告是导致该问题的原因:Warning: this binlog is either in use or was not closed properly.
。
我该如何强制close
记录?
编辑
命令执行后flush logs
,看到有“0 行”受到影响,并且出现了一些新文件,binlog.000001 binlog.000002 binlog.000003 binlog.000004 binlog.index
其内容与几乎相同binlog.000001
。
现在我删除了数据库,并尝试使用它来恢复它mysqlbinlog binlog.0* | mysql -u root -p
,但是数据库没有恢复。
编辑2
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
log-bin=/var/log/mysql/binlog
binlog-do-db=mydb
bind-address = 127.0.0.1
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
PS /var/log/mysql{.err,.log} 都是空的