实验:
停掉 mysql
移除
ib_logfile0
ib_logfile1
ibdata1
重启mysql以后,自动重建了 ib_logfile redo 日志文件 和 ibdata 数据字典文件。
能在数据库里面看到表,但 select * from 的时候,却说找不到表。。哈哈。因为我没有移除掉 innodb 的 *.frm 结构文件
而新建的 ibdata 里面又真的没有 这个表的信息。
我把 ibdata1 mv 回到 原位置。重启 mysql
一切又正常了。 而 bi_logfile 日志文件我就没移回去,一样正常,因为这个是 事务恢复日志,如果不是服务器crash 的话,一般没啥事务要redo。
看手册怎么说物理备份innodb 的,看过了就明白innodb 的物理关系了
If you are able to shut down your MySQL server, you can make a binary backup that consists of all files used by InnoDB
to manage its tables. Use the following procedure:
Shut down the MySQL server and make sure that it stops without errors.
Copy all InnoDB
data files (ibdata
files and .ibd
files) into a safe place.
Copy all the .frm
files for InnoDB
tables to a safe place.
Copy all InnoDB
log files (ib_logfile
files) to a safe place.
Copy your my.cnf
configuration file or files to a safe place
看下ib_logfile 是如何被用上的
To recover from a crash of your MySQL server, the only requirement is to restart it. InnoDB
automatically checks the logs and performs a roll-forward of the database to the present. InnoDB
automatically rolls back uncommitted transactions that were present at the time of the crash