Home > Database > Mysql Tutorial > How Can I Recover a MySQL Database from .MYD, .MYI, and .FRM Files?

How Can I Recover a MySQL Database from .MYD, .MYI, and .FRM Files?

Patricia Arquette
Release: 2024-12-20 10:17:09
Original
500 people have browsed it

How Can I Recover a MySQL Database from .MYD, .MYI, and .FRM Files?

Recovering MySQL Database from .myd, .myi, .frm Files

If you possess fragmented MySQL database files (.myd, .myi, and .frm), you may encounter the need to restore the database. MyISAM tables can be easily recovered by placing these files in a database directory. This can be done regardless of the initial database, server, MySQL version, or architecture. File ownership may require adjustment using commands like "chown -R mysql:mysql /var/lib/mysql/dbname."

It's important to note that permissions (GRANT, etc.) are stored within the mysql database and will not be restored simultaneously with the tables. Therefore, it may be necessary to manually recreate users and access permissions using appropriate GRANT statements. Alternatively, the mysql database can be restored, but caution should be exercised during MySQL version updates or mysql_upgrade utility executions.

In most cases, the .FRM (structure) and .MYD (data) files suffice; however, the .MYI (indexes) file can be rebuilt via "repair table."

If downgrading, consulting release notes and running "repair table" is highly recommended due to potential feature additions in newer MySQL versions.

It should be emphasized that intermixing tables can compromise relationship integrity. This method is applicable solely to MyISAM tables.

The above is the detailed content of How Can I Recover a MySQL Database from .MYD, .MYI, and .FRM Files?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template