简体   繁体   English

如何在损坏的硬盘上恢复/恢复我的 MySQL 数据库的数据(记录)?

[英]How to recover/restore the data (records) of my MySQL database on a corrupted hard drive?

A few days ago my hard drive crashed (no booting anymore).几天前,我的硬盘崩溃了(不再启动)。 On this hard drive was a MySQL installation with a database (called "db_cedar").在这个硬盘驱动器上安装了一个带有数据库(称为“db_cedar”)的 MySQL。 Meanwhile, I could connect the corrupted hard drive as a second hard drive to my computer.同时,我可以将损坏的硬盘驱动器作为第二个硬盘驱动器连接到我的计算机。 That means I have full access to the file system of the crashed hard drive, thus on the MySQL files and folders.这意味着我可以完全访问崩溃硬盘驱动器的文件系统,因此可以访问 MySQL 文件和文件夹。

I did never a backup of my database.我从来没有备份我的数据库。 I know, my fault.我知道,我的错。 :-( :-(

Is there a way to recover/restore the data (records) of my database (db_cedar) or even the entire database, for example by copying particular MySQL files or folders (on the crashed hard drive) and puting these on my new hard drive with a freshly installed version of MySQL?有没有办法恢复/恢复我的数据库(db_cedar)甚至整个数据库的数据(记录),例如通过复制特定的 MySQL 文件或文件夹(在崩溃的硬盘上)并将它们放在我的新硬盘上MySQL 的新安装版本? Note: The freshly installed MySQL version on my new hard drive is exactly the same version of the MySQL version on the crashed hard drive.注意:我的新硬盘上新安装的 MySQL 版本与故障硬盘上的 MySQL 版本完全相同。

I would be very happy for any help.我会很高兴得到任何帮助。 Thank you!谢谢!

For restoring InnoDB databases, have a look at my answer here .and have a look at taking cold backup f innodb from mysql docs here .要恢复 InnoDB 数据库,请在此处查看我的答案。并在此处查看mysql 文档中的冷备份 f innodb。 For MYSIAM, it is easier.对于 MYSIAM 来说,这更容易。 As @mluebke said just copy database directory and the my.cnf (for non-windows) or my.ini for windows正如@mluebke 所说,只需复制数据库目录和 my.cnf (用于非 Windows)或 my.ini 用于 windows

Provided the data is not corrupt, you should be able to copy the entire database directory + the my.cnf file and get back up and running.如果数据没有损坏,您应该能够复制整个数据库目录 + my.cnf 文件并重新启动并运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM