Home  >  Article  >  Database  >  使用bin-log日志还原数据库的例子

使用bin-log日志还原数据库的例子

WBOY
WBOYOriginal
2016-06-07 17:55:30701browse

使用bin-log日志还原数据库的例子,供大家学习参考

1、查看是否启用了日志:
show variables like 'log_bin';

2、查看当前日志文件名:
show master status;

3、查找当前有哪些二进制日志文件:
mysql> show binary logs;

4、查看mysql日志:
mysqlbinlog mysql-bin.000001
mysqlbinlog mysql-bin.000006 > /root/bbx.log

5、使用新的binlog日志:(更新数据库日志)

代码如下:
方法一:[root@bogon mysql]# mysqladmin -uroot -p flush-logs
方法二:mysql> FLUSH LOGS;
方法三:[root@bogon mysql]# /etc/init.d/mysql restart

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn