A .frm file stores only a MySQL table's structure — column names, data types, indexes, and the storage engine — and contains no row data. So restoring a database from FRM files alone means recreating empty tables that match the original definitions, not recovering the rows they held. You can do this directly on MySQL 5.7 or earlier, or by reading the files with the mysqlfrm utility from MySQL Utilities on later versions. Rows are gone unless you also have the matching .ibd, .MYD, or .MYI files, and this process can't bring them back.

That distinction matters more than the procedure itself. Plenty of people find a folder of .frm files after a crash, a botched migration, or a decommissioned server and assume the data is inside. It isn't. The data dictionary changes in MySQL 8.0 removed .frm files altogether, so this technique mostly applies to older installations and to archived backups from them. What follows covers when recovery is possible, how to extract definitions, how to rebuild the schema, and where the process breaks down.

What an FRM File Actually Holds

Every MyISAM and InnoDB table in MySQL 5.x had a companion .frm file in the database directory, named after the table (for example, orders.frm). The file is a binary description of the table: the column list, types, defaults, character sets, index definitions, and the storage engine. MySQL read it to know how to interpret the data files sitting beside it.

It does not store rows. There's no way to read customer records, transaction amounts, or log entries out of an .frm file, because they were never written there. For MyISAM tables the rows lived in .MYD and the indexes in .MYI; for InnoDB the rows lived in the shared ibdata tablespace or in per-table .ibd files. If you have only .frm files, you're reconstructing a skeleton.

There's a second limitation. The .frm format is binary and version-specific. A file written by MySQL 5.1 will generally be readable by 5.5 or 5.6, but files from 5.7 can carry newer features, and the format was frozen at 5.7 because MySQL 8.0 replaced it with transactional data dictionary tables. That's why the reliable tool for reading .frm files without a live server is mysqlfrm, which parses the binary directly and prints a CREATE TABLE statement.

Decide Which Recovery Path Fits Before You Start

Two paths exist, and picking the wrong one wastes time.

Path A — you have a running MySQL 5.x server. Copy the .frm files into a database directory, restart or flush, and the server reads the definitions directly. This is fastest but riskiest: a malformed or mismatched file can confuse the server, and it requires filesystem access to the data directory.

Path B — you have only the files and no compatible server, or you'd rather not touch a live instance. Use mysqlfrm to convert each .frm into a CREATE TABLE text statement, then run those statements against a fresh database. This is slower but safer and works across versions, including generating DDL you can load into MySQL 8.0.

Path B is the one I'd recommend in almost every case, because it never risks a production server and produces reviewable text you can fix by hand. Path A makes sense only when you already have a matching 5.x sandbox and need speed.

mysqlfrm is part of the MySQL Utilities package, which Oracle distributed as a separate download and stopped updating years ago. It's still available in distribution repositories and archived downloads. If it isn't installed, you may have to source it from a package mirror or run it from a machine where it's available. This is a real friction point — the tooling is aging, and that's part of why .frm recovery is a legacy skill.

Prerequisites and the Stop Condition

Before touching anything:

Gather all .frm files into one folder. Keep a copy; never work on the originals. Confirm the MySQL version that created them, if you can. Check the server that hosted them, a VERSION file in the data directory, or the .frm header if mysqlfrm reports it. Have a target MySQL instance ready — ideally the same major version, or 8.0 if you're rebuilding forward via generated DDL. Know your storage engines. InnoDB and MyISAM definitions are both in .frm, but the row data lives elsewhere, and the engine name affects later steps.

Stop condition: if the .frm files are corrupted, zero-length, or won't parse with mysqlfrm, don't keep hammering. A professional data-recovery service is the next step if the data matters, because the alternative is guessing at column types and rebuilding a schema that may not match. Also stop if you discover the files came from a version whose features you can't reproduce — for example, 5.7 tables using generated columns and JSON, loaded into a 5.5 server — and decide whether to upgrade the target instead.

Step-by-Step: Extract Definitions With mysqlfrm

This is the safe path. Run it on a copy of the files, ideally on a workstation rather than the database server.

1: List the files and check they're readable. ls -l *.frm should show non-zero sizes. A 0-byte file has no recoverable definition. 2: Run mysqlfrm in diagnostic mode first. The command mysqlfrm --diagnostic /path/to/folder prints the generated CREATE TABLE statements to standard output without needing a server connection. Diagnostic mode parses the binary directly, which is what you want when there's no live instance. The output includes a header comment noting the source file. 3: Redirect the output to a file. mysqlfrm --diagnostic /path/to/folder > recovered.sql. Now you have a text file you can read, diff, and edit. 4: Review every statement. Look for ENGINE=, character sets, AUTO_INCREMENT values, and any columns that came back as generic types. mysqlfrm is good but not perfect; complex defaults, ENUM lists, and some index options may need correction by hand. 5: Check the count. If you had 40 .frm files, you should have 40 CREATE TABLE statements. Missing statements usually mean unreadable files. 6: Load into a scratch database. Create an empty schema and run the script against it. If a statement fails, fix it in the text rather than fighting the server.

Success looks like this: every intended table exists in the scratch database with the right columns, and SHOW CREATE TABLE output matches your memory of the original. Cross-check a couple of tables against application documentation or old screenshots if you have them.

The failure mode to watch for is silent type drift. mysqlfrm may render a DECIMAL(10,2) as DECIMAL or lose a default value. That won't stop the script from running, but it will corrupt behavior later. Spot-check the money and date columns.

Step-by-Step: Reconstruct Directly on a MySQL 5.x Server

This is the path where the server reads the .frm files itself. Use it only in a sandbox. The mechanism: MySQL builds a table's definition from the .frm, so if you place the file in the right database directory, the server will treat the table as existing — with no data — once it opens it.

1: Stop the MySQL server on the sandbox instance. Don't do this against production. 2: Create the target database directory under the data directory, or use an existing one. The folder name is the schema name. 3: Copy the .frm files into that directory. Set ownership to match the mysql user so the server can read them. 4: Start the server. It reads the directory on startup. In MySQL 5.x, FLUSH TABLES forces a re-read of table definitions if you add files while running, but a restart is more reliable. 5: Inspect with SHOW TABLES. The tables should appear. Run SHOW CREATE TABLE name on each to confirm the definition was parsed correctly. 6: Fix or drop anything that fails to open. A server error such as "Incorrect information in file" means the .frm is corrupt or from an incompatible version. You can't always repair these; sometimes re-running mysqlfrm in diagnostic mode is the only way to salvage a definition.

A subtlety: with InnoDB, the server may expect a matching .ibd or a ibdata page for the table. Without it, opening the table can error or leave it in a state where SHOW CREATE TABLE works but SELECT doesn't. That's expected — the data isn't there. The .frm gives you the schema, and that's the whole point of this exercise.

Another subtlety with the shared InnoDB tablespace: if you copy .frm files from a server that used innodb_file_per_table, the server will look for per-table .ibd files that don't exist. The definition still loads, but you may see warnings. Dropping the table and recreating it from the mysqlfrm text is often cleaner than fighting these warnings.

What You Can and Can't Actually Recover

Be honest about the ceiling here, because it determines whether the effort is worth it.

Recoverable from .frm alone: Table names and schema structure Column names, types, and most attributes Index and primary-key definitions Storage engine and character set settings Enough information to rebuild empty tables and restore an application's expectations

Not recoverable from .frm alone: Any rows of data Foreign-key relationships that were defined in the schema (these are sometimes in the .frm, but dependent table data isn't) Triggers, stored procedures, and views — these lived in other files or the data dictionary Auto-increment current values, though the definition often includes a starting value Statistics, fragmentation state, and anything else stored at the data level

When the Rows Still Exist: Using .ibd, .MYD, and .MYI Beside the FRM

This is the qualification that matters. A .frm file sitting next to a .ibd file means you may have both structure and data, and the full table can be recovered. The .frm gives you the definition; the .ibd holds InnoDB data; .MYD and .MYI hold MyISAM data and indexes.

The mechanism: InnoDB can import a tablespace with ALTER TABLE ... IMPORT TABLESPACE, but it requires (a) the target table to exist with an identical definition and (b) the .ibd file copied in place, and the server must be configured for transportable tablespaces. That's exactly where the .frm helps: you regenerate the CREATE TABLE from it, create the matching empty table, then attach the .ibd. The rows come from the .ibd, not the .frm.

If you have only .frm files and no .ibd, .MYD, or .MYI, there is no data to point the recovered schema at. The tables come back empty, and no tool changes that.

There is a subtlety worth flagging: .frm files can sit alongside stale data files from a different point in time, and the definitions won't always match the data. Check file timestamps and row counts before assuming the data belongs to the schema. When they disagree, the .frm is the safer guide to structure and the data files are what you test.

Worked Estimate: How Much Work Is This?

Suppose you recover 120 tables across a dozen applications. Assume mysqlfrm parses 95 percent cleanly → about 114 statements load without edits. The remaining 6 need manual correction. At roughly 2–5 minutes per statement to load and inspect, and 10–15 minutes per problem table to fix, you're looking at 4–8 hours of hands-on work, plus testing. That's for schema only. Repopulating 120 tables with data is a separate project, and the .frm files contribute nothing to it.

The estimate scales with table count and complexity, not row count — the .frm doesn't care how many rows a table had. If the schema has heavy indexing or unusual types, budget toward the high end. If it's a plain application schema, the low end holds.

The practical takeaway from the arithmetic is that this is a schema-rebuilding task, not a data-recovery task, and it's measured in hours rather than a one-click restore. Whether that's worth it depends on why you need the database. Rebuilding an application's structure to restart it fresh is a fine use. Trying to resurrect old records is not, because the files simply don't contain them.

Common Failure Modes and How to Recognize Them

The script loads but the table behaves wrong. Usually a silently altered type or lost default. Compare SHOW CREATE TABLE against any surviving documentation, or against the application's model definitions.

mysqlfrm outputs garbage or errors. The file is corrupted or from an incompatible version. Try another version of mysqlfrm; if that fails, treat the definition as lost.

The server refuses to open a table after a direct file copy. Version mismatch or missing data file. Fall back to the mysqlfrm path.

The recovered schema is missing tables. Some directories mix engines and some .frm files may be unreadable. Cross-check counts and filenames, and never assume a missing table means an empty one.

You're expecting data and find none. This is the most common misunderstanding, and no troubleshooting fixes it. Confirm what other files you have before spending more time.

The rule I'd apply across all of these: treat recovery as a two-stage job — definitions first, data second — and confirm which stage is possible before doing either. FRM files carry the first stage only, and rebuilding from them gives you a working structure and an honest answer about what's gone.

FAQ

Can I read .frm files without MySQL installed?

Yes, with mysqlfrm --diagnostic, which parses the binary directly. You'll need the MySQL Utilities package, which is legacy software, so availability varies by system. A plain text editor can't decode them meaningfully.

Do MySQL 8.0 servers use .frm files?

No. MySQL 8.0 moved table metadata into the transactional data dictionary and stopped creating .frm files. If you find them, they came from a 5.x instance (or earlier). You can still parse them with mysqlfrm and load the generated DDL into 8.0.

Is it possible to recover the actual data rows from .frm files?

No. The file contains structure only. Rows lived in .ibd, .MYD, or ibdata files, and without those, no amount of parsing recovers them. Plan accordingly before investing hours in schema reconstruction.