MYSQL日志与备份还原问题详解日志与备份还原问题详解
本文为大家分享了MYSQL的日志与备份还原,供大家参考,具体内容如下
一、错误日志一、错误日志
当数据库出现任何故障导致无法使用时,第一时间先去查看该日志
1、服务器启动关闭过程中的信息
2、服务器运行过程中的错误信息
日志存放路径,可以通过命令查看:
日志文件命名格式:host_name.err
二、二进制日志二、二进制日志
又称BINLOG,记录所有的DDL语句和DML语句,不包括查询语句。这个日志不仅非常重要,而且作为开发人员也非常喜欢这
个日志。从它的定义可以看出,这个日志记录了所有会改变表结构和表数据的事件,所以一旦数据被误删除或者因为其他原因
导致数据丢失,我们可以通过这个日志将数据恢复。是不是觉得很炫酷。
日志存放路径:与错误日志在同一个目录下
命名方式:默认方式为hostname-bin + 编号
mysql每次启动或者flush日志时都会生成一个新的binlog,编号从1开始递增。单个日志达到一定大小时,也会生成新的文件。
1、开启记录、开启记录binlog的开关的开关
在myslq的安装目录下,有一个配置文件:my.ini
innodb_buffer_pool_size=107M
# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=54M
# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
评论0