复制/var/lib/mysql目录是否可以替代mysqldump? [英] Is copying the /var/lib/mysql directory a good alternative to mysqldump?
本文介绍了复制/var/lib/mysql目录是否可以替代mysqldump?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于我要对整个debian系统进行完整备份,因此我在考虑是否拥有/var/lib/mysql
目录的副本是否可以替代使用mysqldump转储表./p>
- 该目录中是否包含所有需要的信息?
- 可以将单个表导入另一个mysql吗?
- 在(可能略有不同)不同的mysql服务器版本上还原这些文件时是否会出现问题?
解决方案
- 是
- 是的,如果该表使用的是MyISAM(默认)引擎.如果使用的是InnoDB,则不会.
- 可能没有,如果有的话,您只需执行mysql_upgrade对其进行修复
为避免数据库处于不一致状态,可以在备份之前关闭MySQL或使用LOCK TABLES和FLUSH TABLES.第二种解决方案要好一些,因为MySQL服务器将在备份期间保持可用(尽管是只读的).
Since I'm making a full backup of my entire debian system, I was thinking if having a copy of /var/lib/mysql
directory is a viable alternative to dumping tables with mysqldump.
- are all informations needed contained in that directory?
- can single tables be imported in another mysql?
- can there be problems while restoring those files on a (probably slightly) different mysql server version?
解决方案
- Yes
- Yes if the table is using the MyISAM (default) engine. Not if it's using InnoDB.
- Probably not, and if there is, you just need to execute mysql_upgrade to fix them
To avoid getting databases in a inconsistent state, you can either shutdown MySQL or use LOCK TABLES and then FLUSH TABLES before the backup. The second solution is a little better because the MySQL server will remain available during the backup (albeit read only).
这篇关于复制/var/lib/mysql目录是否可以替代mysqldump?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文